Skip to content
Commit 519049af authored by Mike Snitzer's avatar Mike Snitzer
Browse files

dm: use blkdev_get rather than bdgrab when issuing pass-through ioctl



Otherwise an underlying device's teardown (e.g. SCSI) may race with the
DM ioctl or persistent reservation and result in dereferencing driver
memory that gets freed when the underlying device's final blkdev_put()
occurs.

bdgrab() only increases the refcount for the block_device's inode to
ensure the block_device struct itself will not be freed, but does not
guarantee the block_device will remain associated with the gendisk or
its storage.

Cc: stable@vger.kernel.org # 4.8+
Reported-by: default avatarDavid Jeffery <djeffery@redhat.com>
Suggested-by: default avatarDavid Jeffery <djeffery@redhat.com>
Reviewed-by: default avatarBen Marzinski <bmarzins@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 590347e4
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment