From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE45BC4320E for ; Thu, 12 Aug 2021 06:18:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99F726101E for ; Thu, 12 Aug 2021 06:18:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233610AbhHLGTR (ORCPT ); Thu, 12 Aug 2021 02:19:17 -0400 Received: from verein.lst.de ([213.95.11.211]:43000 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233076AbhHLGTH (ORCPT ); Thu, 12 Aug 2021 02:19:07 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id B6B1368AFE; Thu, 12 Aug 2021 08:18:39 +0200 (CEST) Date: Thu, 12 Aug 2021 08:18:39 +0200 From: Christoph Hellwig To: Pavel Skripkin Cc: Christoph Hellwig , Hillf Danton , syzbot , linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Eric Sandeen , Al Viro , Luis Chamberlain , Greg Kroah-Hartman Subject: Re: [syzbot] WARNING in internal_create_group Message-ID: <20210812061839.GA26497@lst.de> References: <000000000000bd7c8a05c719ecf2@google.com> <20210721033703.949-1-hdanton@sina.com> <20210721043034.GB7444@lst.de> <39ac87a8-42ac-acf7-11eb-ba0b6a9f4a95@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <39ac87a8-42ac-acf7-11eb-ba0b6a9f4a95@gmail.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.