]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rxrpc: Fix leak of rxgk context in rxgk_verify_response()
authorDavid Howells <dhowells@redhat.com>
Wed, 8 Apr 2026 12:12:46 +0000 (13:12 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 9 Apr 2026 01:44:34 +0000 (18:44 -0700)
Fix rxgk_verify_response() to clean up the rxgk context it creates.

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-19-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/rxrpc/rxgk.c

index 064c1531fc991d2bca8b104a808ce3940008a022..c67e3c2ca871a07e8e55a64312795947b2c4b883 100644 (file)
@@ -1270,16 +1270,18 @@ static int rxgk_verify_response(struct rxrpc_connection *conn,
        if (ret < 0) {
                rxrpc_abort_conn(conn, skb, RXGK_SEALEDINCON, ret,
                                 rxgk_abort_resp_auth_dec);
-               goto out;
+               goto out_gk;
        }
 
        ret = rxgk_verify_authenticator(conn, krb5, skb, auth_offset, auth_len);
        if (ret < 0)
-               goto out;
+               goto out_gk;
 
        conn->key = key;
        key = NULL;
        ret = 0;
+out_gk:
+       rxgk_put(gk);
 out:
        key_put(key);
        _leave(" = %d", ret);