Received: by 10.223.185.116 with SMTP id b49csp1085626wrg; Fri, 23 Feb 2018 11:40:06 -0800 (PST) X-Google-Smtp-Source: AH8x226BGyk8SSxhzcSzFCPe8DJ2+LzoroOHX2wEQ3ZZNvrYgNnnnfaTBSO3T8dwiIJAOxhqPjfJ X-Received: by 10.99.153.1 with SMTP id d1mr2218546pge.338.1519414806646; Fri, 23 Feb 2018 11:40:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519414806; cv=none; d=google.com; s=arc-20160816; b=e/sAeMvqYiH7rYpZYvpkDWNFp1AKB936MwCHj2CriDzT7HehvtSl0TQW/nCOl4HYg4 z6LA+fkiTEQqrVMvqnFFCImia1RQoG2yWjhplsFy5rxlaCHEVgxc7y2b8y2VDWk9R/fh pTzbvu54T2v+xF+3s4XnhhXME3Rt/hmOqiJvDtWkbB95jwmgpM9y1k8mEwDv74Yn8V+3 PLp5j7rLI5nwsQTVLMbJzyc5ZaFWyJO8OJ/Yk+979vOBt0Bw+f2Vv3lZbzwLstPEj9TD sgQ0onPSNeyU7fR9+XdUjwij7rV0T2SVxpnsX4nGbYN/pUaBsIvch+rH6Cj+S5UGeQld Th8Q== 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=VuR6tsAyx+jq211cOfpDOM8aGrTaNn6Sw1tFqiUyDFQ=; b=PPcs8rZx+GF2k2LFOW7c3CLXLY+sN8C9D9jm6IPeZlOkhU+AgGxWqzw3nYrEBPzwDC Q4/mhNrE0i6vCtxcDGwgvDSninWMKzkiMcFB34s6BLJXCJjDjBnRpTD/gJo+Q25e0Xsy 5U0UHrClbe/Uv6FhKi+NEIExsQXAwEh0t1Gr4Ewe16qw4pHOCv4Gs/5eruJwi1k8oU+c aDc0KigtMlrY0YSUKI9ncHQqz+kiKjxKGvhRi+rgsDgXm+/1pCJKy3pzAC+tllLSflBx KBTl0Wq34V8cK0mqSSodwSNkVyfOhY2Bv10lumMIJXhd6xt24qq42UeRpJZKWGRnERgF UdLQ== 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 q11-v6si2175590pll.379.2018.02.23.11.39.52; Fri, 23 Feb 2018 11:40:06 -0800 (PST) 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 S934628AbeBWSt6 (ORCPT + 99 others); Fri, 23 Feb 2018 13:49:58 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45450 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934602AbeBWStw (ORCPT ); Fri, 23 Feb 2018 13:49:52 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5698B1197; Fri, 23 Feb 2018 18:49:51 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+dbb7c1161485e61b0241@syzkaller.appspotmail.com, Jason Wang , "Michael S. Tsirkin" , "David S. Miller" Subject: [PATCH 4.14 002/159] vhost: use mutex_lock_nested() in vhost_dev_lock_vqs() Date: Fri, 23 Feb 2018 19:25:10 +0100 Message-Id: <20180223170743.355506815@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jason Wang commit e9cb4239134c860e5f92c75bf5321bd377bb505b upstream. We used to call mutex_lock() in vhost_dev_lock_vqs() which tries to hold mutexes of all virtqueues. This may confuse lockdep to report a possible deadlock because of trying to hold locks belong to same class. Switch to use mutex_lock_nested() to avoid false positive. Fixes: 6b1e6cc7855b0 ("vhost: new device IOTLB API") Reported-by: syzbot+dbb7c1161485e61b0241@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/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -904,7 +904,7 @@ static void vhost_dev_lock_vqs(struct vh { int i = 0; for (i = 0; i < d->nvqs; ++i) - mutex_lock(&d->vqs[i]->mutex); + mutex_lock_nested(&d->vqs[i]->mutex, i); } static void vhost_dev_unlock_vqs(struct vhost_dev *d)