Skip to contentSkip to conversation

rxrpc: Miscellaneous fixes

PATCH Applied David Howells 2 participants 4 messages Jul 8, 2025 – Jul 10, 2025

Subsystems (3)

v2 of 12 Applied 2/2 Latest is v12 →

lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

v2 cover rxrpc: Miscellaneous fixes

Here are some miscellaneous fixes for rxrpc:

(1) Fix assertion failure due to preallocation collision.

(2) Fix oops due to prealloc backlog struct not yet having been allocated if no service calls have yet been preallocated.

David

The patches can be found here also:

http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=rxrpc-fixes

Changes
=======
ver #2)
- Don't need to double-set RXRPC_CALL_RELEASED.
- Drop applied frame size warning patch.
- Add patch to fix oops.

David Howells (2):
rxrpc: Fix bug due to prealloc collision
rxrpc: Fix oops due to non-existence of prealloc backlog struct

 net/rxrpc/call_accept.c | 4 ++++
 1 file changed, 4 insertions(+)
author maintainer
#1 lore raw

PATCH v2 1/2 rxrpc: Fix bug due to prealloc collision

When userspace is using AF_RXRPC to provide a server, it has to preallocate incoming calls and assign to them call IDs that will be used to thread related recvmsg() and sendmsg() together. The preallocated call IDs will automatically be attached to calls as they come in until the pool is empty.

To the kernel, the call IDs are just arbitrary numbers, but userspace can use the call ID to hold a pointer to prepared structs. In any case, the user isn't permitted to create two calls with the same call ID (call IDs become available again when the call ends) and EBADSLT should result from sendmsg() if an attempt is made to preallocate a call with an in-use call ID.

However, the cleanup in the error handling will trigger both assertions in rxrpc_cleanup_call() because the call isn't marked complete and isn't marked as having been released.

Fix this by setting the call state in rxrpc_service_prealloc_one() and then marking it as being released before calling the cleanup function.

Fixes 00e907127e6f ("rxrpc: Preallocate peers, conns and calls for incoming service requests")
cc LePremierHomme <[email protected]>
cc Marc Dionne <[email protected]>
cc Jakub Kicinski <[email protected]>
cc Paolo Abeni <[email protected]>
cc "David S. Miller" <[email protected]>
cc Eric Dumazet <[email protected]>
cc Simon Horman <[email protected]>

---

Notes:

    Changes
    =======
    ver #2)
     - Don't need to double-set RXRPC_CALL_RELEASED.
 net/rxrpc/call_accept.c | 1 +
 1 file changed, 1 insertion(+)
net/rxrpc/call_accept.c +1 -0
index a4b363b47cca..7271977b1683 100644
@@ -149,6 +149,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx,
 
 id_in_use:
 	write_unlock(&rx->call_lock);
+	rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, -EBADSLT);
 	rxrpc_cleanup_call(call);
 	_leave(" = -EBADSLT");
 	return -EBADSLT;
author maintainer
#2 lore raw

PATCH v2 2/2 rxrpc: Fix oops due to non-existence of prealloc backlog struct

In reply to David Howells

If an AF_RXRPC service socket is opened and bound, but calls are preallocated, then rxrpc_alloc_incoming_call() will oops because the rxrpc_backlog struct doesn't get allocated until the first preallocation is made.

Fix this by returning NULL from rxrpc_alloc_incoming_call() if there is no backlog struct. This will cause the incoming call to be aborted.

---
 net/rxrpc/call_accept.c | 3 +++
 1 file changed, 3 insertions(+)
net/rxrpc/call_accept.c +3 -0
index 7271977b1683..49fccee1a726 100644
@@ -255,6 +255,9 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx,
 	unsigned short call_tail, conn_tail, peer_tail;
 	unsigned short call_count, conn_count;
 
+	if (!b)
+		return NULL;
+
 	/* #calls >= #conns >= #peers must hold true. */
 	call_head = smp_load_acquire(&b->call_backlog_head);
 	call_tail = b->call_backlog_tail;
#3 lore raw
In reply to David Howells
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 8 Jul 2025 22:15:02 +0100 you wrote:

Here are some miscellaneous fixes for rxrpc:

(1) Fix assertion failure due to preallocation collision.

(2) Fix oops due to prealloc backlog struct not yet having been allocated if no service calls have yet been preallocated.

[...]

Here is the summary with links:
- [net,v2,1/2] rxrpc: Fix bug due to prealloc collision

    https://git.kernel.org/netdev/net/c/69e4186773c6
  - [net,v2,2/2] rxrpc: Fix oops due to non-existence of prealloc backlog struct
    https://git.kernel.org/netdev/net/c/880a88f318cf

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html