Skip to content
Commit 4c49ff3f authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe
Browse files

block: blkdev_get() should access ->bd_disk only after success



d4dc210f (block: don't block events on excl write for non-optical
devices) added dereferencing of bdev->bd_disk to test
GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; however, bdev->bd_disk can be
%NULL if open failed which can lead to an oops.

Test the flag after testing open was successful, not before.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Reported-by: default avatarDavid Miller <davem@davemloft.net>
Tested-by: default avatarDavid Miller <davem@davemloft.net>
Cc: stable@kernel.org
Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
parent 4495a7d4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment