]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rxrpc: Fix potential UAF after skb_unshare() failure
authorDavid Howells <dhowells@redhat.com>
Wed, 22 Apr 2026 16:14:32 +0000 (17:14 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 23 Apr 2026 19:40:52 +0000 (12:40 -0700)
commit1f2740150f904bfa60e4bad74d65add3ccb5e7f8
tree23830c6584d05c839ea956459f38d162d191b553
parentdef304aae2edf321d2671fd6ca766a93c21f877e
rxrpc: Fix potential UAF after skb_unshare() failure

If skb_unshare() fails to unshare a packet due to allocation failure in
rxrpc_input_packet(), the skb pointer in the parent (rxrpc_io_thread())
will be NULL'd out.  This will likely cause the call to
trace_rxrpc_rx_done() to oops.

Fix this by moving the unsharing down to where rxrpc_input_call_event()
calls rxrpc_input_call_packet().  There are a number of places prior to
that where we ignore DATA packets for a variety of reasons (such as the
call already being complete) for which an unshare is then avoided.

And with that, rxrpc_input_packet() doesn't need to take a pointer to the
pointer to the packet, so change that to just a pointer.

Fixes: 2d1faf7a0ca3 ("rxrpc: Simplify skbuff accounting in receive path")
Closes: https://sashiko.dev/#/patchset/20260408121252.2249051-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@kernel.org
Link: https://patch.msgid.link/20260422161438.2593376-4-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/trace/events/rxrpc.h
net/rxrpc/ar-internal.h
net/rxrpc/call_event.c
net/rxrpc/io_thread.c
net/rxrpc/skbuff.c