From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52F084B1297 for ; Thu, 3 Sep 2026 13:50:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788443450; cv=none; b=ijdJuBxQwrVb8UEkWXRtlEX7h+Z7kVRXuP6cEdQ1ii5oG55cbHDMcOmqrAmMOxfKZ4tAhxMoAuBMGpceV+Ut2ihQzHBqhkue0DzRO9Jfva8MRig4cPn7n428yo2/3FQ/ybpilZoPL8VjUjr34dbar1CalD3nuLu5Bs4L5AUG4EQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788443450; c=relaxed/simple; bh=QuuROsOxUVwgEBp4BjqEQST+pWk1H72zW2F9y2ifZa0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=Je/ll6oWQ4DRqzJ7iGVQBIo4fVEmnaqGC0uHYLCMId1i05lI8qc0Nd/V9FCVTjsRjeZlD4W6W/O6lJEPOYqM30qiDi+svoy3x4VeJZFt0tq8Fpq1s3yLXnKAOWQy4az0eW0EvT4ssXCE6CYl/XGJATDSzuGVoUhA3JzQB2ibdDM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=i2TWjzSv; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="i2TWjzSv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A11141F00A3F; Thu, 3 Sep 2026 13:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788443439; bh=ZKi4AiX6xoBOG5H1qFln8olRMdZ6Gfdm3M3BOnF6h9U=; h=Subject:To:Cc:From:Date; b=i2TWjzSv2t36677VSnDrmuM0OJBx6Xh2ZM2zlLwaSEKeuypQqlZHDe9C4I6XXO6Nm qshcmq1Ebzi15pF20MFEOJQoeRKMKN7TKj+PcoiHsZa4bC1JwA0EOUuG9TkRssnEcy KtrONZhWM5m7QyHEHBnMjut4gUYfya4mTniJ6Vpc= Subject: FAILED: patch "[PATCH] NFSD: Prevent client use-after-free during close_lru reaping" failed to apply to 6.6-stable tree To: cel@kernel.org,jlayton@kernel.org Cc: From: Date: Thu, 03 Sep 2026 15:34:05 +0200 Message-ID: <2026090305-identical-flame-bc6a@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 2330b788d732f43668b965b3105b37ceb276dfea # git commit -s git send-email --to '' --in-reply-to '2026090305-identical-flame-bc6a@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 2330b788d732f43668b965b3105b37ceb276dfea Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Thu, 9 Jul 2026 13:40:31 -0400 Subject: [PATCH] NFSD: Prevent client use-after-free during close_lru reaping An nfs4_openowner left on nn->close_lru after its final CLOSE keeps its last closed stateid in oo_last_closed_stid, holding only a raw pointer to its nfs4_client. The laundromat reaps timed-out entries, drops nn->client_lock, and calls nfs4_put_stid(), which dereferences the client through cl_lock. Nothing pins the client across that window, so a concurrent force_expire_client() can free it and nfs4_put_stid() reads freed memory. __destroy_client() hits the same race, walking clp->cl_openowners without cl_lock. Pin the client with cl_rpc_users before dropping client_lock, and skip clients already expiring. __destroy_client() then cleans up its own close_lru entries through release_last_closed_stateid(), so teardown no longer races the laundromat. Fixes: 217526e7ecc9 ("nfsd: protect the close_lru list and oo_last_closed_stid with client_lock") Cc: stable@vger.kernel.org Reviewed-by: Jeff Layton Link: https://patch.msgid.link/20260709-cel-v4-8-1d519d9be0cb@kernel.org Signed-off-by: Chuck Lever diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 4acd02f1642c..20556b8f186a 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -7581,11 +7581,16 @@ nfs4_laundromat(struct nfsd_net *nn) if (!state_expired(<, oo->oo_time)) break; list_del_init(&oo->oo_close_lru); + clp = oo->oo_owner.so_client; + if (is_client_expired(clp)) + continue; stp = oo->oo_last_closed_stid; oo->oo_last_closed_stid = NULL; + atomic_inc(&clp->cl_rpc_users); spin_unlock(&nn->client_lock); nfs4_put_stid(&stp->st_stid); spin_lock(&nn->client_lock); + put_client_no_renew_locked(clp); } spin_unlock(&nn->client_lock);