From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7300BC4167E for ; Mon, 7 Feb 2022 11:30:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384290AbiBGL1b (ORCPT ); Mon, 7 Feb 2022 06:27:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381938AbiBGLRl (ORCPT ); Mon, 7 Feb 2022 06:17:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 249EAC03FEC4; Mon, 7 Feb 2022 03:17:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9D15461314; Mon, 7 Feb 2022 11:17:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A90C3C004E1; Mon, 7 Feb 2022 11:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644232658; bh=qsiRW50ItvfqNk39rx4iQNL2zPEHh9RQigQRJslqeGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PXMBtdcLtPW8Y4M+3FXfwaAKhYuAJSBMH0yOK5Gd+QgLwkplQ+XMso3Goueac3R19 jUgegMCSLfVzjqQK7DHa1NZBF6EqfCLoEbXnxXRAAhVdNxzn0vVMx837XY0AQjpwIx lC6c3zAmmkBCuJbv4qCHhBtWEVIWLgsbEbduMFvY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dai Ngo , Chuck Lever , Bruce Fields Subject: [PATCH 4.19 81/86] nfsd: nfsd4_setclientid_confirm mistakenly expires confirmed client. Date: Mon, 7 Feb 2022 12:06:44 +0100 Message-Id: <20220207103800.339431786@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103757.550973048@linuxfoundation.org> References: <20220207103757.550973048@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dai Ngo commit ab451ea952fe9d7afefae55ddb28943a148247fe upstream. >>From RFC 7530 Section 16.34.5: o The server has not recorded an unconfirmed { v, x, c, *, * } and has recorded a confirmed { v, x, c, *, s }. If the principals of the record and of SETCLIENTID_CONFIRM do not match, the server returns NFS4ERR_CLID_INUSE without removing any relevant leased client state, and without changing recorded callback and callback_ident values for client { x }. The current code intends to do what the spec describes above but it forgot to set 'old' to NULL resulting to the confirmed client to be expired. Fixes: 2b63482185e6 ("nfsd: fix clid_inuse on mount with security change") Signed-off-by: Dai Ngo Signed-off-by: Chuck Lever Reviewed-by: Bruce Fields Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4state.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3446,8 +3446,10 @@ nfsd4_setclientid_confirm(struct svc_rqs status = nfserr_clid_inuse; if (client_has_state(old) && !same_creds(&unconf->cl_cred, - &old->cl_cred)) + &old->cl_cred)) { + old = NULL; goto out; + } status = mark_client_expired_locked(old); if (status) { old = NULL;