From: Jens Axboe <axboe@kernel.dk>
To: Pavel Skripkin <paskripkin@gmail.com>, josef@toxicpanda.com
Cc: hch@lst.de, linux-block@vger.kernel.org, nbd@other.debian.org,
linux-kernel@vger.kernel.org,
syzbot+9937dc42271cd87d4b98@syzkaller.appspotmail.com
Subject: Re: [PATCH] block: nbd: add sanity check for first_minor
Date: Mon, 16 Aug 2021 10:56:54 -0600 [thread overview]
Message-ID: <a04bfff4-bb38-0d21-3432-5086efaa6c69@kernel.dk> (raw)
In-Reply-To: <20210812091501.22648-1-paskripkin@gmail.com>
On 8/12/21 3:15 AM, Pavel Skripkin wrote:
> Syzbot hit WARNING in internal_create_group(). The problem was in
> too big disk->first_minor.
>
> disk->first_minor is initialized by value, which comes from userspace
> and there wasn't any sanity checks about value correctness. It can cause
> duplicate creation of sysfs files/links, because disk->first_minor will
> be passed to MKDEV() which causes truncation to byte. Since maximum
> minor value is 0xff, let's check if first_minor is correct minor number.
>
> NOTE: the root case of the reported warning was in wrong error handling
> in register_disk(), but we can avoid passing knowingly wrong values to
> sysfs API, because sysfs error messages can confuse users. For example:
> user passed 1048576 as index, but sysfs complains about duplicate
> creation of /dev/block/43:0. It's not obvious how 1048576 becomes 0.
> Log and reproducer for above example can be found on syzkaller bug
> report page.
Applied, thanks.
--
Jens Axboe
prev parent reply other threads:[~2021-08-16 16:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 9:15 [PATCH] block: nbd: add sanity check for first_minor Pavel Skripkin
2021-08-12 9:16 ` Christoph Hellwig
2021-08-12 9:42 ` Pavel Skripkin
2021-08-12 15:35 ` Eric Blake
2021-08-16 15:26 ` Wouter Verhelst
2021-08-16 15:55 ` Wouter Verhelst
2021-08-16 16:56 ` Jens Axboe [this message]
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=a04bfff4-bb38-0d21-3432-5086efaa6c69@kernel.dk \
--to=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd@other.debian.org \
--cc=paskripkin@gmail.com \
--cc=syzbot+9937dc42271cd87d4b98@syzkaller.appspotmail.com \
/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;
as well as URLs for NNTP newsgroup(s).