Received: by 10.223.176.5 with SMTP id f5csp1143657wra; Fri, 2 Feb 2018 11:59:31 -0800 (PST) X-Google-Smtp-Source: AH8x227XCO07JLbBjhW+cPh/hCXqry0ZYC0I3d+KiVq8oSGdb09SZbBMze9GFDLnNM1iLmxG6sGW X-Received: by 10.101.70.140 with SMTP id h12mr5259613pgr.166.1517601571235; Fri, 02 Feb 2018 11:59:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517601571; cv=none; d=google.com; s=arc-20160816; b=ZfbO2XYpk63EsjB2w5eQo669+Sr9IdWVVs3D9dwph9cZ4qhTu++gmYTUXqbsOU1cGo Opc6DnV//1oLBRBCu3BhW/iM0yiobxsI4ppM4F46kdZgCoeVx42MOUFTPKA3fZB7uI5m lQYc0LWnHRlAGk29oax1gck4CBM0mtrsEeNTxsNOkHBjVZaotExzh1tR9gP1og2zMJCM l63EEHBKgP+eiR4Z6dzVX7BQiG8EAFRX5znprFMJS4O/Zu1/FIFBjMChxi8+o3O1sgga sK4TfdE/0c8KEfDK9pkVlqnD3NcKnEBIttfCZsDlRnuoYOTF96pKvIIGWs/vgX6QSJMH GxjQ== 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=nYddug4mnn7UiOBGMel6z5LgWbTbuVSEdTipZMtYoDg=; b=xwxw8C6MhNtU3usI69O67io2Ll/SjlkIZvuAZgII8aGFdC/c2owTjUaFZw5uoObgyb PC6eZXcY4LCSBDDqadJIIA3T4NBvaZhmu8k4dGAHHI+98GavtAvklJ1qRp/NH40oOOOF KaeDE6sH/rnFxWFtFuX8XyXPbnJOmGF6BxaxtD7Z9bfKsxIJ7PTSJaMO2+2/CqO7pGT8 SwdZCcT7jW1xhRfOEcW2y3RvX9PRtD87TJBdcFdq9y3VSbmA+ot24yR4vGA7nzP8T1d3 rbcf4WQCvCJT1SvbpEMxzWwwZ7L5tLQ4lalsHK9DjSsHkiJYOssJc5NZcNtgkNdQR+mH xagQ== 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 m3-v6si72675pld.358.2018.02.02.11.59.16; Fri, 02 Feb 2018 11:59:31 -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 S1754981AbeBBS3f (ORCPT + 99 others); Fri, 2 Feb 2018 13:29:35 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35000 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752661AbeBBRBG (ORCPT ); Fri, 2 Feb 2018 12:01:06 -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 7429DE4E; Fri, 2 Feb 2018 17:01:05 +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.4 41/67] nfsd: check for use of the closed special stateid Date: Fri, 2 Feb 2018 17:58:10 +0100 Message-Id: <20180202140820.048638109@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: 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); @@ -4704,7 +4705,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)) { @@ -4762,7 +4764,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) {