]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rxrpc: rxrpc_verify_data ensure rx_dec_buffer alloc
authorJeffrey Altman <jaltman@auristor.com>
Tue, 9 Jun 2026 14:09:05 +0000 (15:09 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 12 Jun 2026 23:48:54 +0000 (16:48 -0700)
rxrpc_recvmsg_data() calls rxrpc_verify_data() whenever the
rxrpc_call.rx_dec_buffer is unallocated and assumes that upon
successful return that rx_dec_buffer must be allocated.
However, rxrpc_verify_data() does not request an allocation if
the rxrpc_skb_priv.len is zero.

In addition, failure to allocate rx_dec_buffer will result in a
call to skb_copy_bits() with a NULL destination which can
trigger a NULL pointer dereference.

To prevent these issues rxrpc_verify_data() is modified to
always attempt to allocate the rxrpc_call.rx_dec_buffer if it
is NULL.

This issue was identified with assistance of a private
sashiko instance.

Fixes: d2bc90cf6c75cb ("rxrpc: Fix DATA decrypt vs splice() by copying data to buffer in recvmsg")
Reported-by: Simon Horman <simon.horman@redhat.com>
Signed-off-by: Jeffrey Altman <jaltman@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jiayuan Chen <jiayuan.chen@linux.dev>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: stable@kernel.org
Link: https://patch.msgid.link/20260609140911.838677-2-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/rxrpc/recvmsg.c

index c940600117a48cf2f9b6080b9384fbf18c997f63..a3cf5358f16ed1a2f8711f0e4877513d1415ab57 100644 (file)
@@ -161,7 +161,7 @@ static int rxrpc_verify_data(struct rxrpc_call *call, struct sk_buff *skb)
        struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
        int ret;
 
-       if (sp->len > call->rx_dec_bsize) {
+       if (sp->len > call->rx_dec_bsize || !call->rx_dec_buffer) {
                /* Make sure we can hold a 1412-byte jumbo subpacket and make
                 * sure that the buffer size is aligned to a crypto blocksize.
                 */