Commit e0ea7ce8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] genhd: NULL checking fix

Avoid a possible null-pointer deref.

Found by the Coverity tool
Signed-off-by: default avatarAlexander Nyberg <alexn@dsv.su.se>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c339cc7b
......@@ -660,9 +660,10 @@ int invalidate_partition(struct gendisk *disk, int index)
{
int res = 0;
struct block_device *bdev = bdget_disk(disk, index);
if (bdev)
if (bdev) {
res = __invalidate_device(bdev, 1);
bdput(bdev);
bdput(bdev);
}
return res;
}
......
Markdown is supported
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