]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rxrpc: Fix untrusted unsigned subtract
authorDavid Howells <dhowells@redhat.com>
Thu, 11 Sep 2025 23:06:17 +0000 (00:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Sep 2025 09:16:43 +0000 (11:16 +0200)
commit71571e187106631a8127f2dde780f35caa358d33
treea6ba0495c8dfb5e8a37e106ec2adb6f13d7b850a
parent8ac99c57029e13ebb5fb0d634925abedef32b53a
rxrpc: Fix untrusted unsigned subtract

[ Upstream commit 2429a197648178cd4dc930a9d87c13c547460564 ]

Fix the following Smatch static checker warning:

   net/rxrpc/rxgk_app.c:65 rxgk_yfs_decode_ticket()
   warn: untrusted unsigned subtract. 'ticket_len - 10 * 4'

by prechecking the length of what we're trying to extract in two places in
the token and decoding for a response packet.

Also use sizeof() on the struct we're extracting rather specifying the size
numerically to be consistent with the other related statements.

Fixes: 9d1d2b59341f ("rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI)")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lists.infradead.org/pipermail/linux-afs/2025-September/010135.html
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/2039268.1757631977@warthog.procyon.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/rxrpc/rxgk_app.c