Received: by 10.223.176.5 with SMTP id f5csp988503wra; Fri, 2 Feb 2018 09:18:34 -0800 (PST) X-Google-Smtp-Source: AH8x224jg/8RL0qBj3ux7tE38z9S4oxmNgXI7IsvRZDFSx7qtrMFruz+xqQNjHqKTI1khTrCF0hY X-Received: by 2002:a17:902:6c44:: with SMTP id h4-v6mr36175668pln.373.1517591914220; Fri, 02 Feb 2018 09:18:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517591914; cv=none; d=google.com; s=arc-20160816; b=g5lBL+MInv5QWPydfBYTQAv0M2RdRPlG+GEgXKmwSwZ2QzxUwxJ/Gu/Ockj2VZBWYI MVt8GcII3Y2vxt/CZjLf1yLQIJpqu/luKK/LAM/qbD8PiG9Lp0pPHGLjKZcEVcYsyzus 2IXEtHUxXFRa1uoraSyJCxPe6vmH0C5C0SWFzxN4V1pBoOw/Hd5KAAixWU5RpxQ72P0w Z3cIAzfREpPgSRz9PNI1a6DIieRM4/ogAvluwd7GGhCCsXxpx5sR+hXrzoWQupq34wjO rxriRkryYEVlCIo01VoiEmgXrlTNitsJ6/EttURFcCADbez0nUD9vre44TT7k/49KVV1 RmsQ== 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=tw/QczJbYVIcxm2UJvTe6ddA0epXNQDlRzGrg9XE1jw=; b=gUWEvUcIPcXC6nNCGtPjEzLblM5/YR7mn50Gu/MvObcbkuRJ6/ZPtL+BEl60h0xjJe 8yfqW6FoYqQdojRluRZZkCBpOZhshjE5FWwLJz6O6GwjwfzBU3pYr69K3YbO+HtrZCCW 9iVYH5E+vlKRJV2qfm1x/+z0o6uIpL9s/LQPvuT2vU3vsw0sHZRXh+WkXZ1DyeLjSPKo 4YCIC3dz1o/EIJTc9dOq+yJu/JisGKWSAovEL5Af/TaYm+8fo6+/QSgJm51T5g8MCNut VCAL61aqxgjtP3f47QY0Q0by7lxbVLyuCvL1b7Jo8rq5Gdapi9FUenV7xXOEteQN5HYW 03XQ== 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 b13si2116236pfm.305.2018.02.02.09.18.19; Fri, 02 Feb 2018 09:18:34 -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 S1753782AbeBBRRU (ORCPT + 99 others); Fri, 2 Feb 2018 12:17:20 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38470 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753123AbeBBRKx (ORCPT ); Fri, 2 Feb 2018 12:10:53 -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 2FAB0EB3; Fri, 2 Feb 2018 17:10:52 +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.14 086/156] nfsd: Ensure we check stateid validity in the seqid operation checks Date: Fri, 2 Feb 2018 17:57:47 +0100 Message-Id: <20180202140844.144140129@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: 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 @@ -5180,15 +5180,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);