Received: by 10.223.176.46 with SMTP id f43csp250056wra; Tue, 23 Jan 2018 20:16:44 -0800 (PST) X-Google-Smtp-Source: AH8x2256lnWOQAt5DwZcgibFpjffJ6vzqdbPPQ3zFPA0udjRUNF1wNfl2DWIuWimnmCLMPjQ9nH+ X-Received: by 10.98.25.69 with SMTP id 66mr11935201pfz.219.1516767404538; Tue, 23 Jan 2018 20:16:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516767404; cv=none; d=google.com; s=arc-20160816; b=xD5/bA21pLrazU/8Qz+qNLHxZ/pU/YVtmPstw86DEjzNIYDNwIuymsYMmwoPVukWvO +Jdcv3zW0i+1tukWBlSpsCE3WNKq9G7shReQ7zTN7TkmesnuMsvDjxiugl0ubJH2k5i4 rehdWJnXa79cTatfCly0iO16GYPsonVjk3E/WOeR8Hl7arVib0ZTZ3gGmYCnmPSQRCN1 /QzO16KkQwqvw+b/WM+brphcqujd4ewlqnGV3j5sRM7AjeaF087Sf0aPQ6ZfYE7n9VcV vdYyyc9o3uf/gKVLwugNE/+f3kvm+3smxP2nmalkbYhnJTlvo0FQqclDTLQcqNd5swf5 KnzA== 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=Yvw7snBZZesLJ8xtixA7JkC0v03oRZJQ0xiZcjtpmCM=; b=OEfJGJZdDg64m8qArBkBQWMJYIZv2TD1vKc0+10iLInVojyGeXqn6RDtsZT8Zwn3Dv A6S2rnPVxN4aOaMETkOL4mPbiSqWiSkuQ1VnNzgHd5mlQQg+hYAR4m/E1l3pwr2H5l+1 W4qEPZ5db2trEAxH0kU9zn3w50Dk1SQpQJ4OfBU/OB+gM3VVhge2458GbZaiLD9zKMee nLaOpzaTYiST9MoqIjF9hEhqAalItUu1vaBuG5k2vjdF2pdZa0HrN/bkqa21TkW7SZBP +QIzsMXEpK08f6oxeWtF6ubZaN3WZCVyJV/Wy+gNx3ruZCV9a6Nu0XDFWvB5eHFWug8+ BJEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=jpkn+MMn; 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 r11-v6si5530544plo.624.2018.01.23.20.16.30; Tue, 23 Jan 2018 20:16:44 -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=jpkn+MMn; 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 S932419AbeAXEPm (ORCPT + 99 others); Tue, 23 Jan 2018 23:15:42 -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 S932246AbeAXEP2 (ORCPT ); Tue, 23 Jan 2018 23:15:28 -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=Yvw7snBZZesLJ8xtixA7JkC0v03oRZJQ0xiZcjtpmCM=; b=jpkn+MMnWcDC7vNaPqFSL/fPgzRn8zRqHxulad5eWFo56FF4PijHFCOB7ct5QUxfHAOUWWbD6bhK/gLP+eQKj+pzspTRQvFMecepWgXz6EFKsx8RNtjW1+eDGcDZXk6Q9dC32TdM0qUc83kiS7+WlJem4c0Ii2bx/WzOmnM9R4c= 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:22 +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:22 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Andrew Elble , "J . Bruce Fields" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 060/100] nfsd: check for use of the closed special stateid Thread-Topic: [PATCH AUTOSEL for 4.14 060/100] nfsd: check for use of the closed special stateid Thread-Index: AQHTlMnjXtgB5y9h2kKHrZL0U+j+Yg== Date: Wed, 24 Jan 2018 04:14:55 +0000 Message-ID: <20180124041414.32065-60-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:36RB7GYyIpMo6XpWQ5PoNkjo7eqC2ssOsDCM7POr7SlPt7rgOLqsWUhuMwazA1UZ4dGqnsER5A9E+WArk+H/6ATJ/cPYUiWzeNsQM7ykYE2r7vK+Lf+Eu3oXJodjvSK0e9o2BJPlnp87SZBDCBYlihA2E0BfdNoqwb2ZNTXuRKLCTpyc1kearkixmuKa4i5ziWtfPPqt9HrzQk62l4dX617ZOJLBUxCGwmMBYMo+vG1NY/Hh1EoFuEPHQCUbJW4w x-ms-office365-filtering-correlation-id: 98e37153-701e-41dc-311c-08d562e11662 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: J2xyEDAyaLY5kc6zvKt9qHtVCfb7I542adaHx260LtlyGqg4MKSDQ8z+OFrstby4CB1EYNYHMqB/92qbGsHp/A== 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: 98e37153-701e-41dc-311c-08d562e11662 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 04:14:55.2887 (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: Andrew Elble [ Upstream commit ae254dac721d44c0bfebe2795df87459e2e88219 ] Prevent the use of the closed (invalid) special stateid by clients. Signed-off-by: Andrew Elble Signed-off-by: J. Bruce Fields Signed-off-by: Sasha Levin --- fs/nfsd/nfs4state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index c927dbc8f490..cc74fb0dc02d 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -72,6 +72,7 @@ static u64 current_sessionid =3D 1; #define ZERO_STATEID(stateid) (!memcmp((stateid), &zero_stateid, sizeof(st= ateid_t))) #define ONE_STATEID(stateid) (!memcmp((stateid), &one_stateid, sizeof(sta= teid_t))) #define CURRENT_STATEID(stateid) (!memcmp((stateid), ¤tstateid, size= of(stateid_t))) +#define CLOSE_STATEID(stateid) (!memcmp((stateid), &close_stateid, sizeof= (stateid_t))) =20 /* forward declarations */ static bool check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *l= owner); @@ -4869,7 +4870,8 @@ static __be32 nfsd4_validate_stateid(struct nfs4_clie= nt *cl, stateid_t *stateid) struct nfs4_stid *s; __be32 status =3D nfserr_bad_stateid; =20 - if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) + if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) || + CLOSE_STATEID(stateid)) return status; /* Client debugging aid. */ if (!same_clid(&stateid->si_opaque.so_clid, &cl->cl_clientid)) { @@ -4927,7 +4929,8 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cst= ate, else if (typemask & NFS4_DELEG_STID) typemask |=3D NFS4_REVOKED_DELEG_STID; =20 - if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) + if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) || + CLOSE_STATEID(stateid)) return nfserr_bad_stateid; status =3D lookup_clientid(&stateid->si_opaque.so_clid, cstate, nn); if (status =3D=3D nfserr_stale_clientid) { --=20 2.11.0