Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f089cb8 authored by Felipe Pena's avatar Felipe Pena Committed by Konrad Rzeszutek Wilk
Browse files

block: xen-blkfront: Fix possible NULL ptr dereference



In the blkif_release function the bdget_disk() call might returns
a NULL ptr which might be dereferenced on bdev->bd_openers checking

Signed-off-by: default avatarFelipe Pena <felipensp@gmail.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[v2: Added WARN per Roger's suggestion]
parent 427bfe07
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2011,6 +2011,10 @@ static void blkif_release(struct gendisk *disk, fmode_t mode)

	bdev = bdget_disk(disk, 0);

	if (!bdev) {
		WARN(1, "Block device %s yanked out from us!\n", disk->disk_name);
		goto out_mutex;
	}
	if (bdev->bd_openers)
		goto out;

@@ -2041,6 +2045,7 @@ static void blkif_release(struct gendisk *disk, fmode_t mode)

out:
	bdput(bdev);
out_mutex:
	mutex_unlock(&blkfront_mutex);
}