block: NULL dereference on error path in __blkdev_get()
Subsystems (2)
PATCH 1/1 block: NULL dereference on error path in __blkdev_get()
"disk" is always NULL when we goto out. There was a check for this before, but it was removed in 69e02c59a7d9 "block: Don't check events while open is in progress".
Signed-off-by Dan Carpenter <[email protected]>
fs/block_dev.c +1 -1
@@ -1181,9 +1181,9 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) out_unlock_bdev:mutex_unlock (&bdev->bd_mutex);disk_unblock_events (disk); - out:module_put (disk->fops->owner);put_disk (disk); + out:bdput (bdev);return ret;
Hello,
Quoted 5 lines · Dan Carpenter
"disk" is always NULL when we goto out. There was a check for this before, but it was removed in
69e02c59a7d9"block: Don't check events while open is in progress".Signed-off-by Dan Carpenter <[email protected]>
Acked-by Tejun Heo <[email protected]>
Sorry about the trouble. I hate that function. :-(
Signature · 1 line
tejun
Quoted 7 lines · Tejun Heo
Hello,
Quoted 4 lines · Dan Carpenter
"disk" is always NULL when we goto out. There was a check for this before, but it was removed in
69e02c59a7d9"block: Don't check events while open is in progress".
Quoted 5 lines
Quoted 1 line
Signed-off-by Dan Carpenter <[email protected]>Acked-by Tejun Heo <[email protected]>Sorry about the trouble. I hate that function. :-(
I thought Jens was cc'd. I'll forward the patch to him & LKML.
Thanks.
Signature · 1 line
tejun