]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
rxrpc: Fix integer overflow in rxgk_verify_response()
authorDavid Howells <dhowells@redhat.com>
Wed, 8 Apr 2026 12:12:45 +0000 (13:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Apr 2026 08:46:47 +0000 (10:46 +0200)
commit 699e52180f4231c257821c037ed5c99d5eb0edb8 upstream.

In rxgk_verify_response(), there's a potential integer overflow due to
rounding up token_len before checking it, thereby allowing the length check to
be bypassed.

Fix this by checking the unrounded value against len too (len is limited as
the response must fit in a single UDP packet).

Fixes: 9d1d2b59341f ("rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI)")
Closes: https://sashiko.dev/#/patchset/20260401105614.1696001-10-dhowells@redhat.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/20260408121252.2249051-18-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/rxrpc/rxgk.c

index 13ffdc9352b058637821c6dac643098f0c2764bc..cd16e8e275d24024350ca7bbe402cbb46d0327db 100644 (file)
@@ -1209,7 +1209,8 @@ static int rxgk_verify_response(struct rxrpc_connection *conn,
 
        token_offset    = offset;
        token_len       = ntohl(rhdr.token_len);
-       if (xdr_round_up(token_len) + sizeof(__be32) > len)
+       if (token_len > len ||
+           xdr_round_up(token_len) + sizeof(__be32) > len)
                goto short_packet;
 
        trace_rxrpc_rx_response(conn, sp->hdr.serial, 0, sp->hdr.cksum, token_len);