public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: kvm-devel <kvm@vger.kernel.org>, Asias He <asias@redhat.com>,
	"Nadav Har'El" <nyh@math.technion.ac.il>,
	Abel Gordon <abelg@il.ibm.com>
Subject: Re: [PATCH] vhost: Avoid that vhost_work_flush() locks up
Date: Sun, 7 Jul 2013 14:28:28 +0300	[thread overview]
Message-ID: <20130707112828.GA30405@redhat.com> (raw)
In-Reply-To: <51D6859E.2040500@acm.org>

On Fri, Jul 05, 2013 at 10:36:46AM +0200, Bart Van Assche wrote:
> Wake up work->done waiters even if the TIF_NEED_RESCHED task flag
> has been set. This patch fixes a regression introduced in commit
> d550dda (kernel v3.4).
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> Reference: https://bugzilla.kernel.org/show_bug.cgi?id=60505
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Asias He <asias@redhat.com>
> Cc: Nadav Har'El <nyh@math.technion.ac.il>
> Cc: Abel Gordon <abelg@il.ibm.com>
> Cc: <stable@vger.kernel.org> # v3.4+

I just posted a patch fixing a bug in this function.
[PATCHv3] vhost-net: fix use-after-free in vhost_net_flush
could you please try with this patch applied?

> ---
>  drivers/vhost/vhost.c |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 60aa5ad..cd544ae 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -227,8 +227,16 @@ static int vhost_worker(void *data)
>  		if (work) {
>  			__set_current_state(TASK_RUNNING);
>  			work->fn(work);
> -			if (need_resched())
> +			if (need_resched()) {
> +				spin_lock_irq(&dev->work_lock);
> +				work->done_seq = seq;
> +				if (work->flushing)
> +					wake_up_all(&work->done);
> +				spin_unlock_irq(&dev->work_lock);
> +
> +				work = NULL;
>  				schedule();
> +			}
>  		} else
>  			schedule();
>  
> -- 
> 1.7.10.4

      parent reply	other threads:[~2013-07-07 11:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-05  8:36 [PATCH] vhost: Avoid that vhost_work_flush() locks up Bart Van Assche
2013-07-05 12:49 ` Bart Van Assche
2013-07-07 11:28 ` Michael S. Tsirkin [this message]

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=20130707112828.GA30405@redhat.com \
    --to=mst@redhat.com \
    --cc=abelg@il.ibm.com \
    --cc=asias@redhat.com \
    --cc=bvanassche@acm.org \
    --cc=kvm@vger.kernel.org \
    --cc=nyh@math.technion.ac.il \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox