Linux block layer
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Bart Van Assche <Bart.VanAssche@wdc.com>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [bug report] skd: Avoid that module unloading triggers a use-after-free
Date: Thu, 24 Aug 2017 21:36:54 +0300	[thread overview]
Message-ID: <20170824183654.o4glfufhi243io4c@mwanda> (raw)
In-Reply-To: <1503587051.2702.1.camel@wdc.com>

On Thu, Aug 24, 2017 at 03:04:12PM +0000, Bart Van Assche wrote:
> On Thu, 2017-08-24 at 14:04 +0300, Dan Carpenter wrote:
> > Hello Bart Van Assche,
> > 
> > This is a semi-automatic email about new static checker warnings.
> > 
> > The patch 7277cc67b391: "skd: Avoid that module unloading triggers a 
> > use-after-free" from Aug 17, 2017, leads to the following Smatch 
> > complaint:
> > 
> > drivers/block/skd_main.c:3080 skd_free_disk()
> > 	 error: we previously assumed 'disk' could be null (see line 3074)
> > 
> > drivers/block/skd_main.c
> >   3073	
> >   3074		if (disk && (disk->flags & GENHD_FL_UP))
> >                     ^^^^
> > Existing code checked for NULL.  The new code shuffles things around.
> > 
> >   3075			del_gendisk(disk);
> >   3076	
> >   3077		if (skdev->queue) {
> >   3078			blk_cleanup_queue(skdev->queue);
> >   3079			skdev->queue = NULL;
> >   3080			disk->queue = NULL;
> >                         ^^^^^^^^^^^
> > Now we don't check here.
> > 
> >   3081		}
> >   3082	
> > 
> > regards,
> > dan carpenter
> 
> Hello Dan,
> 
> If you have a look at skd_cons_disk() you will see that skdev->queue != NULL
> implies that skdev->disk != NULL. So I think the above report is a false
> positive.
> 

Oh, yeah.  You're right.  Thanks for taking a look at this.

regards,
dan carpenter

  reply	other threads:[~2017-08-24 18:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24 11:04 [bug report] skd: Avoid that module unloading triggers a use-after-free Dan Carpenter
2017-08-24 15:04 ` Bart Van Assche
2017-08-24 18:36   ` Dan Carpenter [this message]
2017-08-25 20:23     ` Bart Van Assche

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=20170824183654.o4glfufhi243io4c@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Bart.VanAssche@wdc.com \
    --cc=linux-block@vger.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