Patch "afs: Fix netns teardown to cancel the preallocation charger" has been added to the 7.1-stable tree

gregkh at linuxfoundation.org gregkh at linuxfoundation.org
Mon Jul 20 03:53:46 PDT 2026


This is a note to let you know that I've just added the patch titled

    afs: Fix netns teardown to cancel the preallocation charger

to the 7.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     afs-fix-netns-teardown-to-cancel-the-preallocation-charger.patch
and it can be found in the queue-7.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable at vger.kernel.org> know about it.


>From 47694fbc9d24ab6bf210f91e8efe06a10a478064 Mon Sep 17 00:00:00 2001
From: David Howells <dhowells at redhat.com>
Date: Tue, 9 Jun 2026 15:09:08 +0100
Subject: afs: Fix netns teardown to cancel the preallocation charger

From: David Howells <dhowells at redhat.com>

commit 47694fbc9d24ab6bf210f91e8efe06a10a478064 upstream.

Fix the teardown of an afs network namespace to make sure it cancels the
work item that keeps the preallocated rxrpc call/conn/peer queue charged
before incoming calls are disabled (i.e. listen 0).

Also, if net->live is false because the afs netns is being deleted, make
afs_charge_preallocation() skip charging and make afs_rx_new_call() avoid
requeuing the charger.

(This was found by AI review).

Fixes: 00e907127e6f ("rxrpc: Preallocate peers, conns and calls for incoming service requests")
Reported-by: Simon Horman <horms at kernel.org>
Signed-off-by: David Howells <dhowells at redhat.com>
cc: Li Daming <d4n.for.sec at gmail.com>
cc: Ren Wei <n05ec at lzu.edu.cn>
cc: Marc Dionne <marc.dionne at auristor.com>
cc: Jeffrey Altman <jaltman at auristor.com>
cc: linux-afs at lists.infradead.org
cc: stable at kernel.org
Link: https://patch.msgid.link/20260609140911.838677-5-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba at kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 fs/afs/rxrpc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/fs/afs/rxrpc.c
+++ b/fs/afs/rxrpc.c
@@ -127,6 +127,7 @@ void afs_close_socket(struct afs_net *ne
 {
 	_enter("");
 
+	cancel_work_sync(&net->charge_preallocation_work);
 	kernel_listen(net->socket, 0);
 	flush_workqueue(afs_async_calls);
 
@@ -742,7 +743,7 @@ void afs_charge_preallocation(struct wor
 		container_of(work, struct afs_net, charge_preallocation_work);
 	struct afs_call *call = net->spare_incoming_call;
 
-	for (;;) {
+	while (READ_ONCE(net->live)) {
 		if (!call) {
 			call = afs_alloc_call(net, &afs_RXCMxxxx, GFP_KERNEL);
 			if (!call)
@@ -792,7 +793,8 @@ static void afs_rx_new_call(struct sock
 	if (!call->server)
 		trace_afs_cm_no_server(call, rxrpc_kernel_remote_srx(call->peer));
 
-	queue_work(afs_wq, &net->charge_preallocation_work);
+	if (net->live)
+		queue_work(afs_wq, &net->charge_preallocation_work);
 }
 
 /*


Patches currently in stable-queue which might be from dhowells at redhat.com are

queue-7.1/rxrpc-don-t-move-a-peeked-oob-message-onto-the-pending-queue.patch
queue-7.1/rxrpc-fix-potential-infinite-loop-in-rxrpc_recvmsg.patch
queue-7.1/rxrpc-rxrpc_verify_data-ensure-rx_dec_buffer-alloc.patch
queue-7.1/afs-fix-further-netns-teardown-to-cancel-the-preallocation-charger.patch
queue-7.1/afs-fix-netns-teardown-to-cancel-the-preallocation-charger.patch
queue-7.1/rxrpc-fix-ackall-packet-handling.patch
queue-7.1/rxrpc-fix-leak-of-connection-from-oob-challenge.patch
queue-7.1/rxrpc-fix-oob-challenge-leak-in-cleanup-after-notification-failure.patch
queue-7.1/afs-handle-cb.initcallbackstate3-requests-without-a-server-record.patch
queue-7.1/rxrpc-fix-socket-notification-race.patch
queue-7.1/rxrpc-fix-rxrpc_rotate_tx_rotate-to-check-there-s-something-to-rotate.patch
queue-7.1/rxrpc-fix-leak-of-released-call-in-recvmsg-msg_peek.patch
queue-7.1/rxrpc-serialize-kernel-accept-preallocation-with-socket-teardown.patch
queue-7.1/afs-fix-null-pointer-dereference-in-afs_get_tree.patch
queue-7.1/rxrpc-fix-the-reception-of-a-reply-packet-before-data-transmission.patch
queue-7.1/rxrpc-fix-double-unlock-in-rxrpc_recvmsg.patch
queue-7.1/afs-fix-uncancelled-rxrpc-oob-message-handler.patch
queue-7.1/rxrpc-fix-uaf-in-rxgk_issue_challenge.patch



More information about the linux-afs mailing list