Received: by 10.223.176.5 with SMTP id f5csp971459wra; Fri, 2 Feb 2018 09:03:54 -0800 (PST) X-Google-Smtp-Source: AH8x2245eDdgHBJsTRCck0DZAmpRRcMVpfPdCNcZO3pmHx/tQzVbpeqqXTIlp6wwbN97bFzeSHyZ X-Received: by 10.99.99.198 with SMTP id x189mr2785243pgb.248.1517591034222; Fri, 02 Feb 2018 09:03:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517591034; cv=none; d=google.com; s=arc-20160816; b=mXnFai5MIkP04Id7E9j2WmbctBaL92k9wT1OOmEOq7IJyI3z1EmjfqlqZIA0i+Wa8t 2mg0V/Zp+EmfBhQd+oCyl7CeXcYqSPtJx3MY/qJrblqn9EE5LcVD7eVmuYns3vARFWPX dZZuG03p4FRdW6PDM3GAIuMCFiEHnEztnMrMVO0ScBtRs2ne/ZJ+m3VA5HDHNvopuYue s/qzjT7p4EEzLRVlLfBCDqix1ugm1qyLe224v8mr114nTz2MIx24A1r9TQR2Oz1Wiow6 O9buQsLKCiv0QCD5RNY56MUi0U4IfGalil7EcNdzEy0Lkx8puJ6BE6vEdZXnv/h88juH gq0Q== 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=W/IT8JKckb+YoAgOdfIrREaUzShIBrAyquBZoUcVbGM=; b=X5OjpnoWv3fIMlM4tgueNeITqcacywGafODbpVyP0j153zL6zU5bx7R06fmM6SCT+g JJAPWrnhF2ilIC4cdktXUFPYVIgN/mMmnwVkD+y/h9LM9iMYLM7zzUDcSO5jxoerqYgn TxtfwyALyqjnR2pfSDeW/3eG3PtmbHMbZ99JQFJP2y9JNJVM+TrPsBLZebV+W8NFqkqg sRfVJdF3gGjgYIBoCXMBDOfE33KdxfW54uY37/1qY+Y2yl5IhkSWwwr6/3qCj39lQUJ/ e8KOCrCPYVEQHIExHqL7iGTYLFX7ZaevxoZJ66QE24130+Ml2DXHaQ9FE7BrGRmDhwle tqMg== 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 r59-v6si2150673plb.470.2018.02.02.09.03.39; Fri, 02 Feb 2018 09:03:54 -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 S1752558AbeBBRCc (ORCPT + 99 others); Fri, 2 Feb 2018 12:02:32 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34986 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752384AbeBBRA7 (ORCPT ); Fri, 2 Feb 2018 12:00:59 -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 AF674DF6; Fri, 2 Feb 2018 17:00:58 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , "J. Bruce Fields" , Sasha Levin Subject: [PATCH 4.4 39/67] nfsd: Ensure we check stateid validity in the seqid operation checks Date: Fri, 2 Feb 2018 17:58:08 +0100 Message-Id: <20180202140819.902589337@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140815.091718203@linuxfoundation.org> References: <20180202140815.091718203@linuxfoundation.org> User-Agent: quilt/0.65 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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Trond Myklebust [ Upstream commit 9271d7e509c1bfc0b9a418caec29ec8d1ac38270 ] After taking the stateid st_mutex, we want to know that the stateid still represents valid state before performing any non-idempotent actions. Signed-off-by: Trond Myklebust Signed-off-by: J. Bruce Fields Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4state.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -5014,15 +5014,9 @@ static __be32 nfs4_seqid_op_checks(struc status = nfsd4_check_seqid(cstate, sop, seqid); if (status) return status; - if (stp->st_stid.sc_type == NFS4_CLOSED_STID - || stp->st_stid.sc_type == NFS4_REVOKED_DELEG_STID) - /* - * "Closed" stateid's exist *only* to return - * nfserr_replay_me from the previous step, and - * revoked delegations are kept only for free_stateid. - */ - return nfserr_bad_stateid; - mutex_lock(&stp->st_mutex); + status = nfsd4_lock_ol_stateid(stp); + if (status != nfs_ok) + return status; status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate)); if (status == nfs_ok) status = nfs4_check_fh(current_fh, &stp->st_stid);