[net 1/1] tipc: fix memory leak in tipc_accept_from_sock()

Subsystems: networking [general], the rest, tipc network layer

2 messages, 2 authors, 2017-12-05 · open the first message on its own page

[net 1/1] tipc: fix memory leak in tipc_accept_from_sock()

From: Jon Maloy <hidden>
Date: 2017-12-04 21:00:20

When the function tipc_accept_from_sock() fails to create an instance of
struct tipc_subscriber it omits to free the already created instance of
struct tipc_conn instance before it returns.

We fix that with this commit.

Reported-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jon Maloy <redacted>
---
 net/tipc/server.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/net/tipc/server.c b/net/tipc/server.c
index acaef80..bcede09 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -314,6 +314,7 @@ static int tipc_accept_from_sock(struct tipc_conn *con)
 	newcon->usr_data = s->tipc_conn_new(newcon->conid);
 	if (!newcon->usr_data) {
 		sock_release(newsock);
+		conn_put(newcon);
 		return -ENOMEM;
 	}
 
-- 
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

Re: [net 1/1] tipc: fix memory leak in tipc_accept_from_sock()

From: David Miller <davem@davemloft.net>
Date: 2017-12-05 19:54:32

From: Jon Maloy <redacted>
Date: Mon, 4 Dec 2017 22:00:20 +0100
When the function tipc_accept_from_sock() fails to create an instance of
struct tipc_subscriber it omits to free the already created instance of
struct tipc_conn instance before it returns.

We fix that with this commit.

Reported-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jon Maloy <redacted>
Applied and queued up for -stable.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help