[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e85c8b64de7619522a565d8c38e5b2c8c8ed1412.1323199985.git.amit.shah@redhat.com>
Date: Wed, 7 Dec 2011 01:18:48 +0530
From: Amit Shah <amit.shah@...hat.com>
To: Virtualization List <virtualization@...ts.linux-foundation.org>
Cc: Rusty Russell <rusty@...tcorp.com.au>,
"Michael S. Tsirkin" <mst@...hat.com>, levinsasha928@...il.com,
linux-kernel@...r.kernel.org, Amit Shah <amit.shah@...hat.com>
Subject: [PATCH v4 10/12] virtio: balloon: ensure thread exists before stopping it
The vballoon thread could have exited earlier and not re-started.
Ensure we don't try to stop a non-existent thread.
This can happen if the balloon driver goes into S4 state and the thread
exits (this code lands in the next patch). If, however, on restore, the
vqs fail to initialise, the vballoon thread will not be re-created.
Upon a subsequent module removal in that state, we will end up
dereferencing an invalid pointer without this patch.
---
drivers/virtio/virtio_balloon.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 94fd738..22f7c69 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -338,7 +338,9 @@ static void __devexit virtballoon_remove(struct virtio_device *vdev)
{
struct virtio_balloon *vb = vdev->priv;
- kthread_stop(vb->thread);
+ /* Thread may not have started on restore after a suspend */
+ if (vb->thread)
+ kthread_stop(vb->thread);
/* There might be pages left in the balloon: free them. */
while (vb->num_pages)
--
1.7.7.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists