From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E32DC072B1 for ; Thu, 30 May 2019 03:48:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B0C924D2E for ; Thu, 30 May 2019 03:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559188132; bh=ZoOu+9eNxoWTL0myO+IfaODWr5QLt9Z4pCwwIUjUTMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FoNFW0tuAShCdSWE2o6EQdKdF9B10DkeZa0MnILX5z5HXp5enguMmBAoIj9/yKqSi Efzg6fbHhK9mTlnZ7ahqDZ9ONvVR4QrFvUfB55oo69RdOxZTPa+iLbIBZkZVNgkUaq V/jzfK6F+209nYGEqC0XkD0whhqTTJ6qltff4YHs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732147AbfE3Dsr (ORCPT ); Wed, 29 May 2019 23:48:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:58046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730508AbfE3DUS (ORCPT ); Wed, 29 May 2019 23:20:18 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0CE8424820; Thu, 30 May 2019 03:20:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186418; bh=ZoOu+9eNxoWTL0myO+IfaODWr5QLt9Z4pCwwIUjUTMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RIDNfw2AvMUP4H6Y7pc+i+CQEiB+r+I25sbctZ6LFSm2msitku/bA/xXD3te2gW23 U9uu0wxS8UXxIwqiH9i7TTz9XaP7c2Yok5tBBeI7JLQPHL/MuRaLC06IMBDqWLd2c2 hVVxhQw1aJ/SDD5+NXTnvGJLklP1STOZX2pmSvNs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+228a82b263b5da91883d@syzkaller.appspotmail.com, Benjamin Coddington , Anna Schumaker , Sasha Levin Subject: [PATCH 4.14 193/193] NFS: Fix a double unlock from nfs_match,get_client Date: Wed, 29 May 2019 20:07:27 -0700 Message-Id: <20190530030513.442571341@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030446.953835040@linuxfoundation.org> References: <20190530030446.953835040@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit c260121a97a3e4df6536edbc2f26e166eff370ce ] 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 Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- 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 65da2c105f434..0c7008fb6d5ab 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -305,9 +305,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