From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH] vhost: Avoid that vhost_work_flush() locks up Date: Sun, 7 Jul 2013 14:28:28 +0300 Message-ID: <20130707112828.GA30405@redhat.com> References: <51D6859E.2040500@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm-devel , Asias He , "Nadav Har'El" , Abel Gordon To: Bart Van Assche Return-path: Received: from mx1.redhat.com ([209.132.183.28]:7974 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751703Ab3GGL13 (ORCPT ); Sun, 7 Jul 2013 07:27:29 -0400 Content-Disposition: inline In-Reply-To: <51D6859E.2040500@acm.org> Sender: kvm-owner@vger.kernel.org List-ID: 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 > Reference: https://bugzilla.kernel.org/show_bug.cgi?id=60505 > Cc: Michael S. Tsirkin > Cc: Asias He > Cc: Nadav Har'El > Cc: Abel Gordon > Cc: # 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