Skip to content

Commit

Permalink
rxrpc: Fix a memory leak in rxkad_verify_response()
Browse files Browse the repository at this point in the history
A ticket was not released after a call of the function
"rxkad_decrypt_ticket" failed. Thus replace the jump target
"temporary_error_free_resp" by "temporary_error_free_ticket".

Fixes: 8c2f826 ("rxrpc: Don't put crypto buffers on the stack")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Markus Elfring <Markus.Elfring@web.de>
  • Loading branch information
Qiushi Wu authored and David Howells committed May 22, 2020
1 parent 8a1d24e commit f45d01f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/rxrpc/rxkad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ static int rxkad_verify_response(struct rxrpc_connection *conn,
ret = rxkad_decrypt_ticket(conn, skb, ticket, ticket_len, &session_key,
&expiry, _abort_code);
if (ret < 0)
goto temporary_error_free_resp;
goto temporary_error_free_ticket;

/* use the session key from inside the ticket to decrypt the
* response */
Expand Down Expand Up @@ -1230,7 +1230,6 @@ static int rxkad_verify_response(struct rxrpc_connection *conn,

temporary_error_free_ticket:
kfree(ticket);
temporary_error_free_resp:
kfree(response);
temporary_error:
/* Ignore the response packet if we got a temporary error such as
Expand Down

0 comments on commit f45d01f

Please sign in to comment.