Received: by 10.223.176.5 with SMTP id f5csp988409wra; Fri, 2 Feb 2018 09:18:27 -0800 (PST) X-Google-Smtp-Source: AH8x226Ikj9Cn6F0Wvi7AmdVZKfFNSRtw2iA4wMb9lBr8vO8Zd8KlimR2Cq2r9YwEZlvb7OUsUHw X-Received: by 2002:a17:902:34a:: with SMTP id 68-v6mr36271940pld.276.1517591907805; Fri, 02 Feb 2018 09:18:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517591907; cv=none; d=google.com; s=arc-20160816; b=WdAccXvmFi+AS/txRzxhLavnC2VDxPehVeg666x8HFK1ykYdqwUIe5jnKe6L3bAW0h jpN0F41xaNf2To1g0ZiDgAoCOLIAB3pC2gNzQXK3H17KVR9bvfO8we5W4et5FOHYAuY9 tF2BiDqI7eqdKQDvfCkgY6C7Lk7pM4G1mBRlYAybkTz21he3+h3cp6MUt6de7Qyw4WaU 6ynNdPLZpn3dGQEf9qHkOaXkrWwJByVQBL/4tchpP0vpNN9Ol8YiGg4hHHvvkaS5uaBL gd1WY9CEuKnzBHIoiwz1eT2mfKul5cNih+cCsu7TTa+9BkyU3oJYMgTiyL1icAgbiDK/ PxLA== 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=OKdO/x2NYcJv+trYYXRVzIhp08XoSS1Mt9XbRqMn/WM=; b=s+C6twIiHbnA4DBwEKYQtVDbIUaTkHj1DdSeXTI2mJop7mWqXf/3GJoehhcMxWszD5 d7tw0S5ma9zL7iUt/URYoSGQbX9Qf6HAS27J08ssHgIW4L2u9jE1PKttg2Pm4+84ZN5l R/oxGdQ/QV2NydSeKwO+0NH/ZgoiHVWwZBhS0ZP0Y+y1yo1Pdui/aRNd0v4rhgJckNQ+ CEMeAkouq23wAFk1kTL0Y/VahthQz1dFAXC/DAnc72EJqq/Px6U/jW3DVLbL1zRYo7cU 1s0GipqlZhq6KnBNaZg8Ou2KXi+1jo49xaA14K1SQkCXCzpg/vHtMgAkePDz3KFRNNjj PcbQ== 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 i14si1684805pgp.516.2018.02.02.09.18.12; Fri, 02 Feb 2018 09:18:27 -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 S1753424AbeBBRRo (ORCPT + 99 others); Fri, 2 Feb 2018 12:17:44 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38518 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752626AbeBBRLE (ORCPT ); Fri, 2 Feb 2018 12:11:04 -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 31935EB3; Fri, 2 Feb 2018 17:11:02 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Elble , "J. Bruce Fields" , Sasha Levin Subject: [PATCH 4.14 088/156] nfsd: check for use of the closed special stateid Date: Fri, 2 Feb 2018 17:57:49 +0100 Message-Id: <20180202140844.238432095@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -72,6 +72,7 @@ static u64 current_sessionid = 1; #define ZERO_STATEID(stateid) (!memcmp((stateid), &zero_stateid, sizeof(stateid_t))) #define ONE_STATEID(stateid) (!memcmp((stateid), &one_stateid, sizeof(stateid_t))) #define CURRENT_STATEID(stateid) (!memcmp((stateid), ¤tstateid, sizeof(stateid_t))) +#define CLOSE_STATEID(stateid) (!memcmp((stateid), &close_stateid, sizeof(stateid_t))) /* forward declarations */ static bool check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner); @@ -4869,7 +4870,8 @@ static __be32 nfsd4_validate_stateid(str struct nfs4_stid *s; __be32 status = nfserr_bad_stateid; - 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_compou else if (typemask & NFS4_DELEG_STID) typemask |= NFS4_REVOKED_DELEG_STID; - if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) + if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) || + CLOSE_STATEID(stateid)) return nfserr_bad_stateid; status = lookup_clientid(&stateid->si_opaque.so_clid, cstate, nn); if (status == nfserr_stale_clientid) {