Received: by 10.192.165.156 with SMTP id m28csp1091505imm; Wed, 11 Apr 2018 12:14:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx48jsWI77AiQy9IihWbF1R4GAHh1DE3YFuVPRxXjU1Eo1SS/dLMUhzzZVI/R0HskxMwCXe0w X-Received: by 10.99.119.133 with SMTP id s127mr4278680pgc.441.1523474076982; Wed, 11 Apr 2018 12:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523474076; cv=none; d=google.com; s=arc-20160816; b=N4mLUaBaiNDERAOhtNly2rRjIIqD0nSjtchc6+LBtEzfqnhGehh+U9wg8LuqH6bYWy HzX9aVmP6lktIArjKfvXMwjpCrIxO5LwkJ6s6R/GtF+IQCf3ackc9O6BKb4Ro4tU47s4 KLTpsyfgtjVHEUo3W+12Gt+N4hYTI3PsegE1yowjMeV7GvxgEI4uQRZhOXPGZrF/jG/w iSS/bK6L57FMt6kFw5FEinNtla8OBjUTN8dgS6i7T0BZaDygxr6haJD6ZYC0VQ+LkwSH qZeFRxq6OgSgXHS53y8vDKi1Ffwlurwe5KmJAqF5WVhWq/nsZ4D3fbrREtNAwouA1Pjv W4CQ== 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=clXL8o0fnO27S19yR5Me9t4NE9ocjs2qJ1oZEXD1Kdo=; b=TzCbzFR8mlskW+zqxD9eGt+Z/h9rjm+ZtrYYhtoN4wka871h0y3SQGDTsRKkq8bc5f v2s/lrK/bKj1DakRes3v/7ddgmG8ZccNL7N0Jgo2s/DGUPAY7btJzVbHjqW0ZgEHkPRu SvIxKUHZKtfKtpA8x9BsfDQJeg0Ha/IHqoxkbFTkPSvF1kp42VoO+FFaLbhdIGX+I81c 2WOCrosSonZI9vtZsUhwo87ybTE6X2li5P7HoMfzDrcb61vFxiDs17rIbY098AjTwhRT aBzmzOQdSAwhWFdFYHegZT6Av0oWzG85KLtDgZw38/ys3Dfs4iH9u7/QqhF6Cljxi61j hPVw== 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 g61-v6si1678517plb.686.2018.04.11.12.13.59; Wed, 11 Apr 2018 12:14:36 -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 S935280AbeDKTGl (ORCPT + 99 others); Wed, 11 Apr 2018 15:06:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40868 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935257AbeDKTGj (ORCPT ); Wed, 11 Apr 2018 15:06:39 -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 5F622D3F; Wed, 11 Apr 2018 19:06:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+7f073540b1384a614e09@syzkaller.appspotmail.com, Jason Wang , "Michael S. Tsirkin" , "David S. Miller" Subject: [PATCH 4.9 306/310] vhost_net: add missing lock nesting notation Date: Wed, 11 Apr 2018 20:37:25 +0200 Message-Id: <20180411183635.706806905@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 aaa3149bbee9ba9b4e6f0bd6e3e7d191edeae942 ] We try to hold TX virtqueue mutex in vhost_net_rx_peek_head_len() after RX virtqueue mutex is held in handle_rx(). This requires an appropriate lock nesting notation to calm down deadlock detector. Fixes: 0308813724606 ("vhost_net: basic polling support") Reported-by: syzbot+7f073540b1384a614e09@syzkaller.appspotmail.com Signed-off-by: Jason Wang Acked-by: Michael S. Tsirkin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/vhost/net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -524,7 +524,7 @@ static int vhost_net_rx_peek_head_len(st if (!len && vq->busyloop_timeout) { /* Both tx vq and rx socket were polled here */ - mutex_lock(&vq->mutex); + mutex_lock_nested(&vq->mutex, 1); vhost_disable_notify(&net->dev, vq); preempt_disable(); @@ -657,7 +657,7 @@ static void handle_rx(struct vhost_net * struct iov_iter fixup; __virtio16 num_buffers; - mutex_lock(&vq->mutex); + mutex_lock_nested(&vq->mutex, 0); sock = vq->private_data; if (!sock) goto out;