Received: by 10.223.176.46 with SMTP id f43csp278939wra; Tue, 23 Jan 2018 20:56:05 -0800 (PST) X-Google-Smtp-Source: AH8x225LALNPyujsp/cWW53NzjgHiik+BvUEobWR20a0v64MxIp6tFtorXvoZI1Goh/AIkB7F9zg X-Received: by 10.98.214.129 with SMTP id a1mr11573809pfl.221.1516769765757; Tue, 23 Jan 2018 20:56:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516769765; cv=none; d=google.com; s=arc-20160816; b=cRqN9Yc2Ve1HIW149LGY4js64ThF3Lwod/PxkSDgIIBpK1+Xd7+nDLzN1enP6Wntf9 +x+GZd8y3yHQsRIduzXw6h7MPuirOFtXIpCD6IH1fiK2BZoy9MkUXK3B+Dq5lyGY4Zft w/LA22vPB4tCeoGqC2pxDSq7gCad8kEmRma4zWqfOXmIu+9K9ofnwSgZVQuoSmAHSD9m LbjEpEKq2HN/u+m8aW0OBfl+TMeWXUOSdOeKmumW7ie2xYtj8foz1PxFP8UfEREMLmKJ p+ZRszeZB6aVaRZmfPS1EnEFKQ8Y91lMPs6PXOuSH0Pb+W+OwYWulYAa21qC8uOqoXc8 MUUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=wrl7bJhqJsN5z2iGdZDhkfPZN6bsi+TqXrt8hGsv3Io=; b=HAIHRxg6B1GN/qWgx/vyraQcL3fJ24jVaftauX+ChJJ3OEGM+Myvg7QVMA60swzME2 dtpqsD6LqsQIz44zK7JRq5qr4GJRhDQkgTEMO/f1JlYeerf/I9dO2ByxbLwecJBP7Ezf rBp5ttrq9rQPPgT7oDgJzQWLpxY9KT+05zmNHFB9ve2MOOj21zYNGIP+JyfikNSqaRXb 6ub5bgxQhytB7EOeR0xuETejTxM/gHKq7HU6slS90GI/+GB9VHnE7ZYetBgHFBNiZlVu qLEpUerQc37pw7MVP/H30bv2SGfYDM5naCdfiQPt1GdZ2xMeSO+XoSRAvr2a705wxGfS x32A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=IzrSAel3; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si2298987pfj.60.2018.01.23.20.55.52; Tue, 23 Jan 2018 20:56:05 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=IzrSAel3; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932511AbeAXEzR (ORCPT + 99 others); Tue, 23 Jan 2018 23:55:17 -0500 Received: from mail-dm3nam03on0107.outbound.protection.outlook.com ([104.47.41.107]:39081 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932225AbeAXEP0 (ORCPT ); Tue, 23 Jan 2018 23:15:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wrl7bJhqJsN5z2iGdZDhkfPZN6bsi+TqXrt8hGsv3Io=; b=IzrSAel3Ba/0zvqXJVL7xkL5h/PLz/YL7BDmFpMMJAxuZrGQquHKY1SrLLeivFBscz14daRexx00sPbkpUykCNSiVHWWN2ziROJth5jdDrYyzDdO1GTvGDNgBK4ZGfTPKS5OoGK1gHcjYCh8iCg5Cn4GdMaCLvLv1gwpB8mL/04= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1015.namprd21.prod.outlook.com (52.132.133.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.464.0; Wed, 24 Jan 2018 04:15:21 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7%2]) with mapi id 15.20.0464.000; Wed, 24 Jan 2018 04:15:21 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Trond Myklebust , "J . Bruce Fields" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 058/100] nfsd: Ensure we check stateid validity in the seqid operation checks Thread-Topic: [PATCH AUTOSEL for 4.14 058/100] nfsd: Ensure we check stateid validity in the seqid operation checks Thread-Index: AQHTlMnif5moL7azgEmmY3Yorg5pJA== Date: Wed, 24 Jan 2018 04:14:54 +0000 Message-ID: <20180124041414.32065-58-alexander.levin@microsoft.com> References: <20180124041414.32065-1-alexander.levin@microsoft.com> In-Reply-To: <20180124041414.32065-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1015;7:n8TVDaMNxDjwlcttIKBJ/nZI/YpYi4e3G8Y4ADqFF++mTQgPnVz+0k4aog5cGA2udaRDf1DtZfAt+LrzwD2ip+wHeAJS9vN/JAPwit84uwhquH7KUZ/BmqXN7AZaxheP5cIXk/rehaFf2C3z04kzK3CY+ynp3lDKyQGxODLO5rpzqDQ9ssOZPEF5tnyfjqZFDThQ5zMPvaFNPnfxLKvNW9sZDec1IxeBDfAMnQ4v0+y7ICNlyjiHDCzPKdkJlkpy x-ms-office365-filtering-correlation-id: 0548b07b-74ba-4332-8386-08d562e115db x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020);SRVR:DM5PR2101MB1015; x-ms-traffictypediagnostic: DM5PR2101MB1015: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231046)(2400081)(944501161)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1015;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1015; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39380400002)(376002)(366004)(39860400002)(346002)(199004)(189003)(478600001)(6666003)(106356001)(6512007)(53936002)(2900100001)(36756003)(102836004)(2950100002)(2501003)(10290500003)(97736004)(14454004)(81166006)(72206003)(8936002)(6486002)(1076002)(10090500001)(6346003)(26005)(54906003)(4326008)(575784001)(76176011)(99286004)(86362001)(3660700001)(105586002)(6116002)(8676002)(68736007)(22452003)(66066001)(25786009)(6506007)(5660300001)(305945005)(59450400001)(7736002)(3280700002)(5250100002)(2906002)(107886003)(86612001)(6436002)(316002)(81156014)(3846002)(110136005)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1015;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: 9qpHdNCxLn0FAiUSzPKcp4buOGH7lXLJoe5HOdLZkGFCQVuK8nFCoAIMWafjglo+kK6I/H2X4/3ySq/5SWWnqg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0548b07b-74ba-4332-8386-08d562e115db X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 04:14:54.1979 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- fs/nfsd/nfs4state.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 5ec0ca5cbc1e..c927dbc8f490 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -5184,15 +5184,9 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_comp= ound_state *cstate, stateid_ status =3D nfsd4_check_seqid(cstate, sop, seqid); if (status) return status; - if (stp->st_stid.sc_type =3D=3D NFS4_CLOSED_STID - || stp->st_stid.sc_type =3D=3D 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 =3D nfsd4_lock_ol_stateid(stp); + if (status !=3D nfs_ok) + return status; status =3D check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nf= sd4_has_session(cstate)); if (status =3D=3D nfs_ok) status =3D nfs4_check_fh(current_fh, &stp->st_stid); --=20 2.11.0