[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200619153620.GI11244@42.do-not-panic.com>
Date: Fri, 19 Jun 2020 15:36:20 +0000
From: Luis Chamberlain <mcgrof@...nel.org>
To: Bart Van Assche <bvanassche@....org>
Cc: axboe@...nel.dk, viro@...iv.linux.org.uk,
gregkh@...uxfoundation.org, rostedt@...dmis.org, mingo@...hat.com,
jack@...e.cz, ming.lei@...hat.com, nstange@...e.de,
akpm@...ux-foundation.org, mhocko@...e.com, yukuai3@...wei.com,
martin.petersen@...cle.com, jejb@...ux.ibm.com,
linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Omar Sandoval <osandov@...com>,
Hannes Reinecke <hare@...e.com>,
Michal Hocko <mhocko@...nel.org>,
syzbot+603294af2d01acfdd6da@...kaller.appspotmail.com
Subject: Re: [PATCH v6 6/6] blktrace: fix debugfs use after free
On Fri, Jun 12, 2020 at 07:42:12PM -0700, Bart Van Assche wrote:
> On 2020-06-08 10:01, Luis Chamberlain wrote:
> > + /*
> > + * Blktrace needs a debugfs name even for queues that don't register
> > + * a gendisk, so it lazily registers the debugfs directory. But that
> > + * can get us into a situation where a SCSI device is found, with no
> > + * driver for it (yet). Then blktrace is used on the device, creating
> > + * the debugfs directory, and only after that a driver is loaded. In
> > + * that case we might already have a debugfs directory registered here.
> > + * Even worse we could be racing with blktrace to register it.
> > + */
>
> There are LLD and ULD drivers in the SCSI subsystem. Please mention the
> driver type explicitly. I assume that you are referring to SCSI ULDs
> since only SCSI ULD drivers call device_add_disk()?
I've simplified this and so this is no longer a valid comment.
> > case BLKTRACESETUP:
> > + if (!sdp->device->request_queue->sg_debugfs_dir)
> > + blk_sg_debugfs_init(sdp->device->request_queue,
> > + sdp->disk->disk_name);
>
> How about moving the sg_debugfs_dir check into blk_sg_debugfs_init()?
I found a way to not have to do any of this, the fix will be short and
sweet now.
Luis
Powered by blists - more mailing lists