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 9E7A14B7150 for ; Thu, 3 Sep 2026 14:30:10 +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=1788445824; cv=none; b=GavnlKWQpTKsY7lz+bXQiicTaQVX8QknhMMEyPiWLtFptwFqK53DC6El6QpdyVVMB0wEKsTxDwKTlkCmAaSugwKM/vB4AmV/U4LbPkeu1DddcmIy4Iy5JE9WHlNVKRK3q7/3eBK6LbAmF7tr8a20yPEhudZMaq1UhKTIvrmATEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788445824; c=relaxed/simple; bh=sj7koayqiVoqqviRTgNWA2FUKTwPh12T7dPGPUIoAEc=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=KNqycOi8yt/0ZiC9x4f7Wv+No0Brle1z2BQVS2uSQxey4ccIZSpD2Gu3etQOwmRetLDIYUR/oln7n9cApBZdZ9SzGjSJESvHt6hgA8I6Xk+Za+4IxupehIQfSsbzohZfgte+ry+1RRfk9zOtny9u9fomS5L54T5sKy0Qs8HWsMs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eNhCCy7a; 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="eNhCCy7a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB48D1F00A3A; Thu, 3 Sep 2026 14:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788445804; bh=jhGPQVDQYTYmbCd+tuID/kIbSHyLjGuawK6yu/BNHcc=; h=Subject:To:Cc:From:Date; b=eNhCCy7a1syWFzjBx6qjd4j9rwZ/XNOIW+k5kczWggorraMB6x9umszc/a1JyRdd6 K3HHHFNsCm/UrQwnZ/R2Djpu6AZwiopp2F3FIB6APjk+xfjf7XxEcWJ5BpVSn6c0t5 IA/imPVOueNrhLvDsjwCbK1pnTuQqC0pxNEnF99M= Subject: FAILED: patch "[PATCH] sunrpc: defer rq_argp and rq_resp free until after RCU grace" failed to apply to 6.12-stable tree To: jlayton@kernel.org,cel@kernel.org Cc: From: Date: Thu, 03 Sep 2026 16:06:49 +0200 Message-ID: <2026090349-throwing-hardware-8a25@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=UTF-8 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-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.12.y git checkout FETCH_HEAD git cherry-pick -x c479bde671cbe2f9e152834a8b0eb7c3c295bbaf # git commit -s git send-email --to '' --in-reply-to '2026090349-throwing-hardware-8a25@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From c479bde671cbe2f9e152834a8b0eb7c3c295bbaf Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Thu, 11 Jun 2026 16:00:47 -0400 Subject: [PATCH] sunrpc: defer rq_argp and rq_resp free until after RCU grace period MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svc_rqst_free() frees rqstp->rq_argp and rqstp->rq_resp synchronously via kfree(), but defers the rqstp struct free via kfree_rcu(). After svc_exit_thread() calls list_del_rcu() and svc_rqst_free(), there is a window where RCU readers that started before list_del_rcu() can still traverse the thread list and find the rqstp. These readers (e.g. nfsd_nl_rpc_status_get_dumpit()) dereference rqstp->rq_argp, which has already been freed — a use-after-free. Fix this by moving the kfree of rq_argp and rq_resp into an explicit call_rcu() callback alongside the struct free. Resources not accessed by RCU readers (bvec, buffer pages, scratch folio, auth_data) remain synchronously freed. Fixes: 812443865c5f ("sunrpc: add a rcu_head to svc_rqst and use kfree_rcu to free it") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Jeff Layton Link: https://patch.msgid.link/20260611-nfsd-testing-v2-4-5b90e276f2d9@kernel.org Signed-off-by: Chuck Lever diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 86d39610cf0a..dd80a2eaaa74 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -716,6 +716,15 @@ svc_release_buffer(struct svc_rqst *rqstp) } } +static void svc_rqst_free_rcu(struct rcu_head *head) +{ + struct svc_rqst *rqstp = container_of(head, struct svc_rqst, rq_rcu_head); + + kfree(rqstp->rq_resp); + kfree(rqstp->rq_argp); + kfree(rqstp); +} + static void svc_rqst_free(struct svc_rqst *rqstp) { @@ -724,10 +733,8 @@ svc_rqst_free(struct svc_rqst *rqstp) svc_release_buffer(rqstp); if (rqstp->rq_scratch_folio) folio_put(rqstp->rq_scratch_folio); - kfree(rqstp->rq_resp); - kfree(rqstp->rq_argp); kfree(rqstp->rq_auth_data); - kfree_rcu(rqstp, rq_rcu_head); + call_rcu(&rqstp->rq_rcu_head, svc_rqst_free_rcu); } static struct svc_rqst *