Amos Kong
2014-Oct-10 22:51 UTC
[3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck
I received two mails about faile to apply patches to 3.16-stable tree: FAILED: patch "[PATCH] virtio-rng: skip reading when we start to remove the device" failed to apply to 3.16-stable tree FAILED: patch "[PATCH] virtio-rng: fix stuck of hot-unplugging busy device" failed to apply to 3.16-stable tree Amit already backported two patches for 3.16-stable, then cherry-pick of my two patches works. Thanks. Amos Kong (2): virtio-rng: fix stuck of hot-unplugging busy device virtio-rng: skip reading when we start to remove the device drivers/char/hw_random/virtio-rng.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 1.9.3
Amos Kong
2014-Oct-10 22:51 UTC
[3.16 stable PATCH 1/2] virtio-rng: fix stuck of hot-unplugging busy device
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 at redhat.com> Reviewed-by: Amit Shah <amit.shah at redhat.com> Cc: stable at vger.kernel.org Signed-off-by: Rusty Russell <rusty at rustcorp.com.au> (cherry picked from commit 3856e548372513665670ca5db60d9a74b970fe0d) Signed-off-by: Amos Kong <akong at redhat.com> --- drivers/char/hw_random/virtio-rng.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index f1aa13b..b50252c 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) -- 1.9.3
Amos Kong
2014-Oct-10 22:51 UTC
[3.16 stable PATCH 2/2] virtio-rng: skip reading when we start to remove the device
Before we really unregister the hwrng device, reading will get stuck if the virtio device is reset. We should return error for reading when we start to remove the device. Signed-off-by: Amos Kong <akong at redhat.com> Reviewed-by: Amit Shah <amit.shah at redhat.com> Cc: stable at vger.kernel.org Signed-off-by: Rusty Russell <rusty at rustcorp.com.au> (cherry picked from commit f49819560f53b7f3a596a8ea2e6764dc86695b62) Signed-off-by: Amos Kong <akong at redhat.com> --- drivers/char/hw_random/virtio-rng.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index b50252c..cb1688a 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -37,6 +37,7 @@ struct virtrng_info { char name[25]; int index; bool hwrng_register_done; + bool hwrng_removed; }; @@ -69,6 +70,9 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) int ret; struct virtrng_info *vi = (struct virtrng_info *)rng->priv; + if (vi->hwrng_removed) + return -ENODEV; + if (!vi->busy) { vi->busy = true; init_completion(&vi->have_data); @@ -137,6 +141,7 @@ static void remove_common(struct virtio_device *vdev) { struct virtrng_info *vi = vdev->priv; + vi->hwrng_removed = true; vi->data_avail = 0; complete(&vi->have_data); vdev->config->reset(vdev); -- 1.9.3
Amos Kong
2014-Nov-04 04:32 UTC
[3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck
On Sat, Oct 11, 2014 at 06:51:47AM +0800, Amos Kong wrote:> I received two mails about faile to apply patches to 3.16-stable tree: > > FAILED: patch "[PATCH] virtio-rng: skip reading when we start to remove the device" failed to apply to 3.16-stable tree > FAILED: patch "[PATCH] virtio-rng: fix stuck of hot-unplugging busy device" failed to apply to 3.16-stable tree > > Amit already backported two patches for 3.16-stable, then cherry-pick > of my two patches works. > > Thanks.Ping Greg, thanks.> Amos Kong (2): > virtio-rng: fix stuck of hot-unplugging busy device > virtio-rng: skip reading when we start to remove the device > > drivers/char/hw_random/virtio-rng.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > -- > 1.9.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo at vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/-- Amos.
Luis Henriques
2014-Nov-05 16:02 UTC
[3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck
Hi Amos On Tue, Nov 04, 2014 at 12:32:27PM +0800, Amos Kong wrote:> On Sat, Oct 11, 2014 at 06:51:47AM +0800, Amos Kong wrote: > > I received two mails about faile to apply patches to 3.16-stable tree: > > > > FAILED: patch "[PATCH] virtio-rng: skip reading when we start to remove the device" failed to apply to 3.16-stable tree > > FAILED: patch "[PATCH] virtio-rng: fix stuck of hot-unplugging busy device" failed to apply to 3.16-stable tree > > > > Amit already backported two patches for 3.16-stable, then cherry-pick > > of my two patches works. > > > > Thanks. > > Ping Greg, thanks. >I'm now doing the extended stable maintenance of the 3.16 kernel, as Greg has EOL'ed it. Anyway, I will be queuing these 2 patches for the extended 3.16 kernel. Thank you! Cheers, -- Lu?s> > Amos Kong (2): > > virtio-rng: fix stuck of hot-unplugging busy device > > virtio-rng: skip reading when we start to remove the device > > > > drivers/char/hw_random/virtio-rng.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > -- > > 1.9.3 > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > > the body of a message to majordomo at vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > Please read the FAQ at http://www.tux.org/lkml/ > > -- > Amos. > -- > To unsubscribe from this list: send the line "unsubscribe stable" in > the body of a message to majordomo at vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Greg KH
2014-Nov-19 01:20 UTC
[3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck
On Tue, Nov 04, 2014 at 12:32:27PM +0800, Amos Kong wrote:> On Sat, Oct 11, 2014 at 06:51:47AM +0800, Amos Kong wrote: > > I received two mails about faile to apply patches to 3.16-stable tree: > > > > FAILED: patch "[PATCH] virtio-rng: skip reading when we start to remove the device" failed to apply to 3.16-stable tree > > FAILED: patch "[PATCH] virtio-rng: fix stuck of hot-unplugging busy device" failed to apply to 3.16-stable tree > > > > Amit already backported two patches for 3.16-stable, then cherry-pick > > of my two patches works. > > > > Thanks. > > Ping Greg, thanks.Why me? 3.16-stable is end-of-life, I'm no longer maintaining it, so what can I do here with these patches? confused, greg k-h
Maybe Matching Threads
- [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck
- [PATCH v3 0/2] virtio-rng: fix hotunplug
- [PATCH v3 0/2] virtio-rng: fix hotunplug
- [PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.
- [PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.