Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp691856yba; Thu, 9 May 2019 04:38:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyc+/RpZpiFBJ2ydW3UUejFX3yf9Y+PwaG9wJra4y51dpRuKP8JRoXcxlvUY8vLG0NEW5rS X-Received: by 2002:a65:6688:: with SMTP id b8mr4663368pgw.81.1557401928808; Thu, 09 May 2019 04:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557401928; cv=none; d=google.com; s=arc-20160816; b=S5mokWWwRsGYBI4GAWghaXg/mx4vb0ilQU5HEXfq36U3SeRk+hkdSaDOgS1Q+YihFQ YgzBy0KrXd20ntFkmNo9rhWYYqJDoK+FgbX98EgZVDs+o81alih8R3q+4i9dzQpDHRD/ F4fSkm3fnOpblO1ik49bkLaG/DW/MN9Z5Kp1JbBB23lqN4PthYmkeZq6eJcwk9qGawrv y3PwySS2gRu0/0ndgvfzQ+Xuv/qtO45L6Yux1W7KfdVThFL6VQ/SFMi9V7wFccpqoUcq PONIJnaaUVQGPc8mgaGVho4toMNf/ihHhqsDU0n5qAV6TGUdr0FYIFgpNmb3tj1tDwa7 S+eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=WUuQwmk7kgCQYiR0q+Sec0EdyFYDu4OXWDa9qCBY/zk=; b=EPklAnICH3cQbhR+pzGys5PowHZ2F+gt/UAzG60RCHhJHEXUWoOkFuKqxuvbZ4S+7/ SDKkFIURBYRCXIV4hEpPRTeufkk5xESYaw8IpjaMkTDf9JzmwgXmeedacApQAQmvHgGr vOwD/Fu5cceVHI85f0/BYvCJ6jRwZfhydumgm0MEK0/MxGSLLXyy1V2AjVtUmvpGqkzR nIY5J2zSFmZ71iAJu/rr3FXkd/Ra6bwelHKJGkZxyveSEDN60TUgWvzxivnuR8uDWOhy A6v/qQJO85YT8y74QuidONqYjqC4hGC/h+ZOeEf3pzlTbE0VXoRwLmo9Pg3EQcduEHeP IxIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 83si2419153pfs.247.2019.05.09.04.38.25; Thu, 09 May 2019 04:38:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726411AbfEILhx (ORCPT + 99 others); Thu, 9 May 2019 07:37:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725963AbfEILhx (ORCPT ); Thu, 9 May 2019 07:37:53 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D7FF307EA8F; Thu, 9 May 2019 11:37:53 +0000 (UTC) Received: from [172.16.176.1] (ovpn-112-5.rdu2.redhat.com [10.10.112.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 62CEA1001E6D; Thu, 9 May 2019 11:37:51 +0000 (UTC) From: "Benjamin Coddington" To: anna.schumaker@netapp.com Cc: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, syzkaller-bugs@googlegroups.com, trond.myklebust@hammerspace.com, "Roberto Bergantinos Corpas" , syzbot Subject: Re: WARNING: locking bug in nfs_get_client Date: Thu, 09 May 2019 07:37:50 -0400 Message-ID: In-Reply-To: References: <000000000000c3e9dc0588695e22@google.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 09 May 2019 11:37:53 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org I think nfs_get_client and nfs_match_client could use a refactor.. but the trivial fix is: 8<--------------------------------- From 4ef2fc5912c5980890e781f8c0d941330254c100 Mon Sep 17 00:00:00 2001 Message-Id: <4ef2fc5912c5980890e781f8c0d941330254c100.1557401467.git.bcodding@redhat.com> From: Benjamin Coddington Date: Thu, 9 May 2019 07:25:21 -0400 Subject: [PATCH] NFS: Fix a double unlock from nfs_match,get_client Now that nfs_match_client drops the nfs_client_lock, we should be careful to always return it in the same condition: locked. Fixes: 950a578c6128 ("NFS: make nfs_match_client killable") Reported-by: syzbot+228a82b263b5da91883d@syzkaller.appspotmail.com Signed-off-by: Benjamin Coddington --- fs/nfs/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 06e8719655f0..da74c4c4a244 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -299,9 +299,9 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat spin_unlock(&nn->nfs_client_lock); error = nfs_wait_client_init_complete(clp); nfs_put_client(clp); + spin_lock(&nn->nfs_client_lock); if (error < 0) return ERR_PTR(error); - spin_lock(&nn->nfs_client_lock); goto again; } -- 2.20.1