[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210812061839.GA26497@lst.de>
Date: Thu, 12 Aug 2021 08:18:39 +0200
From: Christoph Hellwig <hch@....de>
To: Pavel Skripkin <paskripkin@...il.com>
Cc: Christoph Hellwig <hch@....de>, Hillf Danton <hdanton@...a.com>,
syzbot <syzbot+9937dc42271cd87d4b98@...kaller.appspotmail.com>,
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com,
Eric Sandeen <sandeen@...hat.com>,
Al Viro <viro@...iv.linux.org.uk>,
Luis Chamberlain <mcgrof@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [syzbot] WARNING in internal_create_group
On Thu, Aug 12, 2021 at 12:37:08AM +0300, Pavel Skripkin wrote:
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -1725,7 +1725,17 @@ static int nbd_dev_add(int index)
> refcount_set(&nbd->refs, 1);
> INIT_LIST_HEAD(&nbd->list);
> disk->major = NBD_MAJOR;
> +
> + /* Too big first_minor can cause duplicate creation of
> + * sysfs files/links, since first_minor will be truncated to
> + * byte in __device_add_disk().
> + */
> disk->first_minor = index << part_shift;
> + if (disk->first_minor > 0xff) {
> + err = -EINVAL;
> + goto out_free_idr;
> + }
> +
> disk->minors = 1 << part_shift;
> disk->fops = &nbd_fops;
> disk->private_data = nbd;
>
>
> What to do you think about it?
This sounds reasonable and looks good to me.
Powered by blists - more mailing lists