From: Benjamin Marzinski <bmarzins@redhat.com>
To: Junrui Luo <moonafterrain@outlook.com>
Cc: Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@kernel.org>,
Mikulas Patocka <mpatocka@redhat.com>,
dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
Yuhao Jiang <danisjiang@gmail.com>
Subject: Re: [PATCH] dm mirror: fix integer overflow in create_dirty_log()
Date: Mon, 2 Mar 2026 12:40:30 -0500 [thread overview]
Message-ID: <aaXLjmY-Zf5Bni4U@redhat.com> (raw)
In-Reply-To: <SYBPR01MB78818AAF59CB119B833C535DAF71A@SYBPR01MB7881.ausprd01.prod.outlook.com>
On Sun, Mar 01, 2026 at 09:10:58PM +0800, Junrui Luo wrote:
> The argument count calculation in create_dirty_log() performs
> `*args_used = 2 + param_count` before validating against argc. When a
> user provides a param_count close to UINT_MAX via the device mapper
> table string, this unsigned addition wraps around to a small value,
> causing the subsequent `argc < *args_used` check to be bypassed.
>
> The overflowed param_count is then passed as argc to dm_dirty_log_create(),
> where it can cause out-of-bounds reads on the argv array.
>
> Fix by comparing param_count against argc - 2 before performing the
> addition, following the same pattern used by parse_features() in the
> same file. Since argc >= 2 is already guaranteed, the subtraction is
> safe.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Reported-by: Yuhao Jiang <danisjiang@gmail.com>
> Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
next prev parent reply other threads:[~2026-03-02 17:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 13:10 Junrui Luo
2026-03-02 17:40 ` Benjamin Marzinski [this message]
2026-04-05 6:48 ` Junrui Luo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aaXLjmY-Zf5Bni4U@redhat.com \
--to=bmarzins@redhat.com \
--cc=agk@redhat.com \
--cc=danisjiang@gmail.com \
--cc=dm-devel@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=moonafterrain@outlook.com \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome