diff mbox

[3.16.y-ckt,extended,stable] Patch "virtio-rng: fix stuck of hot-unplugging busy device" has been added to staging queue

Message ID 1415619126-9984-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques Nov. 10, 2014, 11:32 a.m. UTC
This is a note to let you know that I have just added a patch titled

    virtio-rng: fix stuck of hot-unplugging busy device

to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue

This patch is scheduled to be released in version 3.16.7-ckt1.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

From d024fb8a370b95ca0d3134dbab36c3f7da795df5 Mon Sep 17 00:00:00 2001
From: Amos Kong <akong@redhat.com>
Date: Thu, 11 Sep 2014 22:20:39 +0930
Subject: virtio-rng: fix stuck of hot-unplugging busy device

commit 3856e548372513665670ca5db60d9a74b970fe0d upstream.

When we try to hot-remove a busy virtio-rng device from QEMU monitor,
the device can't be hot-removed. Because virtio-rng driver hangs at
wait_for_completion_killable().

This patch exits the waiting by completing have_data completion before
unregistering, resets data_avail to avoid the hwrng core use wrong
buffer bytes.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/char/hw_random/virtio-rng.c | 2 ++
 1 file changed, 2 insertions(+)

--
2.1.0
diff mbox

Patch

diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index f1aa13b21f74..b50252c08009 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -137,6 +137,8 @@  static void remove_common(struct virtio_device *vdev)
 {
 	struct virtrng_info *vi = vdev->priv;

+	vi->data_avail = 0;
+	complete(&vi->have_data);
 	vdev->config->reset(vdev);
 	vi->busy = false;
 	if (vi->hwrng_register_done)