Received: by 10.192.165.156 with SMTP id m28csp1089989imm; Wed, 11 Apr 2018 12:12:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/x77SzE+5gQ6DWTpcpS2ddXz3s1ANs4ZurRjmEmR2oMh+KFyXYxvFj4ImRZNQHU0Mmk36W X-Received: by 10.101.89.65 with SMTP id g1mr4319632pgu.185.1523473970677; Wed, 11 Apr 2018 12:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523473970; cv=none; d=google.com; s=arc-20160816; b=pIdQ5MDKv0141VIgYL8koSe8TfzSfXXV5Cnx/8LPZZ+1wnM2lrmYqsz7MSoRCfj6GY h7qj+Xjf6qWrJo9LYvfiPDhAws62Lwzmo5CirbCnO+EddvY80NFmSD+ugCvuq8AbzF/B vuT0beLZ+yCuMi7qgbnae+QgZ8cj5NSwXyhJ2iOq/lZ6v8hWc8dhRWf9PW3JdaEHnXI7 EXGcW0KfAO10R2VM2gyZ+kMH0YBTefHtC4EhXyRXc0JtAP4atkhdEYxpsIAkT+2Uhv1b kzC3Yfn3uWMVuLAVPjqORY9zsggYNm23/wmfiALupdVl+umcX9/zzHnKdenqUbIryIuj yT1g== 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=mQZDkdgB4bbDNhmmtUaGq4GvbalggiGkwuoH8rqF1QM=; b=JxGn2VeAOa4RYclufo1X6m9IiNixmYYI1Gb5ZcI7MfH2VPb8jhyVy8KvBRLFgnPLcD 8xSN41JL1pMC3OHY2+aRVCdOOmGqe4ctlK37uaDb5h7KZYO2h7bb6H9CjenikkKWcizk RQFIl/N4153OmLb6Kv05i34Cotw6mBFZWoJK+f4M2FdlubpIklnxSmrYMpEsNPJrFAPD n5UDxOtdo0srFhg2VGeoVD6VR2VRojXvQFB33/jcg9Bx/6cOhZGmAlg/FQa1t+6LJro5 CCMDh2O02wNdnMgi/2Us7Lq4mW4Z9TQ2l1KzDodVgFzhROxR5tqc7D4KM8MpZEydcYp6 ewqA== 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 u70si1128058pgd.619.2018.04.11.12.12.14; Wed, 11 Apr 2018 12:12:50 -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 S935341AbeDKTHA (ORCPT + 99 others); Wed, 11 Apr 2018 15:07:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40984 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934027AbeDKTG5 (ORCPT ); Wed, 11 Apr 2018 15:06:57 -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 3A75CD8B; Wed, 11 Apr 2018 19:06:57 +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.9 288/310] vhost: correctly remove wait queue during poll failure Date: Wed, 11 Apr 2018 20:37:07 +0200 Message-Id: <20180411183634.992629242@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@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.9-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 @@ -211,8 +211,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; }