Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1540836pxb; Thu, 16 Sep 2021 09:32:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxINhBZ4XYi2B+Yv0h8YQkWHtYKxMgqbxU9cLo4o/ITntk6PFJx2Bz+TWwUkDcy3oMaUBCI X-Received: by 2002:a05:6e02:f13:: with SMTP id x19mr4758263ilj.216.1631809939293; Thu, 16 Sep 2021 09:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631809939; cv=none; d=google.com; s=arc-20160816; b=NrGypGURlylg8vcm1GHmeKxVeKrADyQX5iLuvqvdP5crWSOGt+jPsTsYUmlIlc5LyZ B48uUQBq1IP+F4mBLW4/WgAp9F+yUNopJe0IwmuW262Pcns6Nqvv+J9uX/bkNy03Ocbn o6IWIe0T8Wo4qiS9JiTBN7CU8z6Ual1pbrmtlYllCuZAI5ZdGFx/08rVlhlKoY/OdnCv GegJCJYRVKWPVNmN89y20bhcZPfht8ODvwdFpLO/Sf8cfsd/RVatlOQdkBSXLw8ad+ce Unnko5pBvJQK6ACO53OK+SgW/6YnXY/Bj9Gc3TSj4Auv4262m+8MVLPV3CGrAvufLzjA YVJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+591fZA3Qq6dCCxauK7lAT1UIWDyqCRuC38GMSmOKBA=; b=P+EDc8O84HrRGssNP+4gY7knmuA0278nx1ZReqUaTXg0OzF4z/iogDwppnQrCGbYBK c/bCZ4F9yiGnwPXX1cp2YuxEFmvEP3DwzZ6J+/PccrcJYVBlVyhekNKNW1Kw8r96csTV VuCf+E5lnlPO2NWloxfuDVLfVHoLq1pTsLb7F3314R2GC1lqhtouj7Czlgocb3XO8AaP cXiBRAKJulGC0601O/0lfEAXvvYA7M/kL3TNAUbGIBqf9zsKSwL7n5HAhy8N5iL3c8Tr +ttKML4wRpNnJGJu84gfktHodm2ka2A9nrEwlkgvwJ3LVAmssk3Drf6fkBC2CDrzkB2R FP2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xntu0EWQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si2618004ila.182.2021.09.16.09.32.06; Thu, 16 Sep 2021 09:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xntu0EWQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241518AbhIPQag (ORCPT + 99 others); Thu, 16 Sep 2021 12:30:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:59260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241192AbhIPQVV (ORCPT ); Thu, 16 Sep 2021 12:21:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B70261407; Thu, 16 Sep 2021 16:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808888; bh=n4I1esLoy8tpS2difjeMdqt5o8f1DNiNEBQ5TqrEtPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xntu0EWQxb3g2YjQ+6IOtCO0YaPZ8ZhXUtGOg17c712fZx7YA3dUDQm5vVKN6D/ZE lV/H+0i1t2mE7u0bCZ7KyGcJrwo3Efvv9hqerKhrTzE8H+vOTJJ0EpJtSBnE5UJ2PB V7BrIm/w94/PkmDtK3l0LWl/vTSKzmxMyGfPEHf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "J. Bruce Fields" , Chuck Lever , Sasha Levin Subject: [PATCH 5.10 260/306] nfsd: fix crash on LOCKT on reexported NFSv3 Date: Thu, 16 Sep 2021 18:00:05 +0200 Message-Id: <20210916155802.937771714@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: J. Bruce Fields [ Upstream commit 0bcc7ca40bd823193224e9f38bafbd8325aaf566 ] Unlike other filesystems, NFSv3 tries to use fl_file in the GETLK case. Signed-off-by: J. Bruce Fields Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4state.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 142aac9b63a8..0313390fa4b4 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -6855,8 +6855,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, /* * The NFSv4 spec allows a client to do a LOCKT without holding an OPEN, * so we do a temporary open here just to get an open file to pass to - * vfs_test_lock. (Arguably perhaps test_lock should be done with an - * inode operation.) + * vfs_test_lock. */ static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) { @@ -6871,7 +6870,9 @@ static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct NFSD_MAY_READ)); if (err) goto out; + lock->fl_file = nf->nf_file; err = nfserrno(vfs_test_lock(nf->nf_file, lock)); + lock->fl_file = NULL; out: fh_unlock(fhp); nfsd_file_put(nf); -- 2.30.2