Received: by 10.192.165.156 with SMTP id m28csp55763imm; Tue, 10 Apr 2018 16:17:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/9V776Ao2Tz8lFcj/yab6knWqFh626FOgyAVUT8SZ+klZ4DhbtJpSg+DcB/gK5rDqpy2Lu X-Received: by 2002:a17:902:7004:: with SMTP id y4-v6mr2406310plk.3.1523402233581; Tue, 10 Apr 2018 16:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402233; cv=none; d=google.com; s=arc-20160816; b=Vk7bulwv2RPIv//vJw2Qv8nlZTHsxUQ5Y2eoc7A/4uOcQ7fcFs6FMs2He/6wjmiBBR 3ayRQTBv/znuX0aEVOvB/YxKOvi6/NPZgjAbUrsnHnyI3ywqMIte17V3DGu4YWTBfoUG sWJ566XEGH/QbF60ZUCtUGYj4XIHJKEZ5WXwpB0HOzPatN0V/DXNcIazz6wtVqQYP7Mx PjAkIa3F3g6DDayTXv6Qn9DCqudFA4BHjjlQc15OcRypkGkL6fa/pjCO+Sgf4DkxLdTx 5diPDI91przTJtsU+P0NJSiFOWpvOZR9uxARMTBJ+gfDlSVXOfWPLNQqx2/VsCHiH0ae 8GLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6KkqR5Z+gdW5TAyjeqa2PG2fswOLPsE9WhFJipr6/eY=; b=lnWehJ/3WvnkZeyQk4VkMPYK+Iao3821CoodY387utz+J01z8uRlUBj+JIh08GX26p 1W1mCkoAIe3gWMILiE3vTpNvaiN+uSEV51hbPR/gUJ+1b9/KtT3aEaQOmJZdUX4yZV08 tp6RdwiB+XrN0SQo1ewsQcpM4/Ie6BnqaFRlrYUl6ZEC0RGf76KagdN+KBZSZtV41Wd5 Asxrns4Ed5+PrDExwtU9Nvcu5Ce+eKDtngheAcfznPqR7nwF0zTtu146ekdcyeXgmNc8 va4S/FTY9PgiyOSbjNN5V36t58JQRG8YnQCQxzamopPua+Hof7qHBzICw6idTr6zErXb gALA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j25si2836522pfj.193.2018.04.10.16.16.36; Tue, 10 Apr 2018 16:17:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932072AbeDJWcw (ORCPT + 99 others); Tue, 10 Apr 2018 18:32:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41076 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755102AbeDJWct (ORCPT ); Tue, 10 Apr 2018 18:32:49 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DA7A6BCF; Tue, 10 Apr 2018 22:32:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Darren Kenny , syzbot+c0272972b01b872e604a@syzkaller.appspotmail.com, Jason Wang , "Michael S. Tsirkin" , "David S. Miller" Subject: [PATCH 4.15 137/168] vhost: correctly remove wait queue during poll failure Date: Wed, 11 Apr 2018 00:24:39 +0200 Message-Id: <20180410212806.890245506@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jason Wang [ Upstream commit dc6455a71c7fc5117977e197f67f71b49f27baba ] We tried to remove vq poll from wait queue, but do not check whether or not it was in a list before. This will lead double free. Fixing this by switching to use vhost_poll_stop() which zeros poll->wqh after removing poll from waitqueue to make sure it won't be freed twice. Cc: Darren Kenny Reported-by: syzbot+c0272972b01b872e604a@syzkaller.appspotmail.com Fixes: 2b8b328b61c79 ("vhost_net: handle polling errors when setting backend") Signed-off-by: Jason Wang Reviewed-by: Darren Kenny Acked-by: Michael S. Tsirkin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/vhost/vhost.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -213,8 +213,7 @@ int vhost_poll_start(struct vhost_poll * if (mask) vhost_poll_wakeup(&poll->wait, 0, 0, (void *)mask); if (mask & POLLERR) { - if (poll->wqh) - remove_wait_queue(poll->wqh, &poll->wait); + vhost_poll_stop(poll); ret = -EINVAL; }