All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	jean-philippe.menil@univ-nantes.fr, stable@kernel.org
Cc: Jason Wang <jasowang@redhat.com>
Subject: [PATCH] kvm: fix crash on irqfd deassign
Date: Thu, 17 Mar 2011 10:53:33 +0200	[thread overview]
Message-ID: <20110317085333.GA7336@redhat.com> (raw)

irqfd in kvm used flush_work incorrectly:
it assumed that work scheduled previously can't run
after flush_work, but since kvm uses a non-reentrant
workqueue (by means of schedule_work)
we need flush_work_sync to get that guarantee.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Jean-Philippe Menil <jean-philippe.menil@univ-nantes.fr>
Tested-by: Jean-Philippe Menil <jean-philippe.menil@univ-nantes.fr>
---

Note: this is needed for kernel 2.6.39 and earlier.

 virt/kvm/eventfd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 2ca4535..cdf51c9 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -90,7 +90,7 @@ irqfd_shutdown(struct work_struct *work)
 	 * We know no new events will be scheduled at this point, so block
 	 * until all previously outstanding events have completed
 	 */
-	flush_work(&irqfd->inject);
+	flush_work_sync(&irqfd->inject);
 
 	/*
 	 * It is now safe to release the object's resources
-- 
1.7.3.2.91.g446ac

             reply	other threads:[~2011-03-17  8:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-17  8:53 Michael S. Tsirkin [this message]
2011-03-17 16:13 ` [stable] [PATCH] kvm: fix crash on irqfd deassign Greg KH
2011-03-18 13:21   ` Michael S. Tsirkin
2011-03-18 13:21     ` Michael S. Tsirkin
2011-03-22 12:37 ` Avi Kivity
2011-03-22 12:50   ` Michael S. Tsirkin
2011-03-22 16:41 ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110317085333.GA7336@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jean-philippe.menil@univ-nantes.fr \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.