linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] rxrpc: Fix memory leak in rxkad_verify_response()
@ 2020-08-27 15:55 David Howells
  2020-08-27 20:00 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2020-08-27 15:55 UTC (permalink / raw)
  To: netdev; +Cc: dhowells, linux-afs, linux-kernel, dinghao.liu

From: Dinghao Liu <dinghao.liu@zju.edu.cn>

Fix a memory leak in rxkad_verify_response() whereby the response buffer
doesn't get freed if we fail to allocate a ticket buffer.

Fixes: ef68622da9cc ("rxrpc: Handle temporary errors better in rxkad security")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 net/rxrpc/rxkad.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
index 52a24d4ef5d8..e08130e5746b 100644
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@ -1137,7 +1137,7 @@ static int rxkad_verify_response(struct rxrpc_connection *conn,
 	ret = -ENOMEM;
 	ticket = kmalloc(ticket_len, GFP_NOFS);
 	if (!ticket)
-		goto temporary_error;
+		goto temporary_error_free_resp;
 
 	eproto = tracepoint_string("rxkad_tkt_short");
 	abort_code = RXKADPACKETSHORT;
@@ -1230,6 +1230,7 @@ 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] rxrpc: Fix memory leak in rxkad_verify_response()
  2020-08-27 15:55 [PATCH net] rxrpc: Fix memory leak in rxkad_verify_response() David Howells
@ 2020-08-27 20:00 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-08-27 20:00 UTC (permalink / raw)
  To: dhowells; +Cc: netdev, linux-afs, linux-kernel, dinghao.liu

From: David Howells <dhowells@redhat.com>
Date: Thu, 27 Aug 2020 16:55:46 +0100

> From: Dinghao Liu <dinghao.liu@zju.edu.cn>
> 
> Fix a memory leak in rxkad_verify_response() whereby the response buffer
> doesn't get freed if we fail to allocate a ticket buffer.
> 
> Fixes: ef68622da9cc ("rxrpc: Handle temporary errors better in rxkad security")
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> Signed-off-by: David Howells <dhowells@redhat.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-27 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 15:55 [PATCH net] rxrpc: Fix memory leak in rxkad_verify_response() David Howells
2020-08-27 20:00 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).