From: Dan Carpenter <dan.carpenter@oracle.com>
To: jack@suse.cz
Cc: ceph-devel@vger.kernel.org
Subject: [bug report] block: Move bdi_unregister() to del_gendisk()
Date: Tue, 7 Mar 2017 03:13:22 +0300 [thread overview]
Message-ID: <20170307001322.GA28752@mwanda> (raw)
Hello Jan Kara,
The patch 165a5e22fafb: "block: Move bdi_unregister() to
del_gendisk()" from Feb 8, 2017, leads to the following static
checker warning:
drivers/block/rbd.c:4117 rbd_free_disk()
warn: variable dereferenced before check 'disk->queue' (see line 4116)
drivers/block/rbd.c
4107 static void rbd_free_disk(struct rbd_device *rbd_dev)
4108 {
4109 struct gendisk *disk = rbd_dev->disk;
4110
4111 if (!disk)
4112 return;
4113
4114 rbd_dev->disk = NULL;
4115 if (disk->flags & GENHD_FL_UP) {
4116 del_gendisk(disk);
^^^^^^^^^^^^^^^^^
The patch introduces a new dereference inside this function call.
4117 if (disk->queue)
^^^^^^^^^^^
Check is too late.
4118 blk_cleanup_queue(disk->queue);
4119 blk_mq_free_tag_set(&rbd_dev->tag_set);
4120 }
4121 put_disk(disk);
4122 }
regards,
dan carpenter
next reply other threads:[~2017-03-07 4:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-07 0:13 Dan Carpenter [this message]
2017-03-07 10:24 ` [bug report] block: Move bdi_unregister() to del_gendisk() Dan Carpenter
2017-03-07 10:54 ` Jan Kara
2017-03-07 10:44 ` Jan Kara
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=20170307001322.GA28752@mwanda \
--to=dan.carpenter@oracle.com \
--cc=ceph-devel@vger.kernel.org \
--cc=jack@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.