Skip to contentSkip to conversation

Patch "virtio_blk: fix panic in initialization error path" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Aug 9, 2017

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

virtio_blk: fix panic in initialization error path

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
virtio_blk-fix-panic-in-initialization-error-path.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed Aug 9 10:32:06 PDT 2017

From: Omar Sandoval <[email protected]>
Date: Mon, 9 Jan 2017 11:44:12 -0800
Subject: virtio_blk: fix panic in initialization error path

From: Omar Sandoval <[email protected]>

[ Upstream commit 6bf6b0aa3da84a3d9126919a94c49c0fb7ee2fb3 ]

If blk_mq_init_queue() returns an error, it gets assigned to vblk->disk->queue. Then, when we call put_disk(), we end up calling blk_put_queue() with the ERR_PTR, causing a bad dereference. Fix it by only assigning to vblk->disk->queue on success.

---
 drivers/block/virtio_blk.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/virtio_blk.c +2 -1
@@ -630,11 +630,12 @@ static int virtblk_probe(struct virtio_d
 	if (err)
 		goto out_put_disk;
 
-	q = vblk->disk->queue = blk_mq_init_queue(&vblk->tag_set);
+	q = blk_mq_init_queue(&vblk->tag_set);
 	if (IS_ERR(q)) {
 		err = -ENOMEM;
 		goto out_free_tags;
 	}
+	vblk->disk->queue = q;
 
 	q->queuedata = vblk;
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/nbd-blk_mq_init_queue-returns-an-error-code-on-failure-not-null.patch queue-4.9/virtio_blk-fix-panic-in-initialization-error-path.patch queue-4.9/btrfs-fix-early-enospc-due-to-delalloc.patch