mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
net: tipc: fix possible refcount leak in tipc_sk_create()
[ Upstream commit 00aff3590f
]
Free sk in case tipc_sk_insert() fails.
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Reviewed-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
f65090e5e9
commit
4449e39d90
1 changed files with 1 additions and 0 deletions
|
@ -502,6 +502,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock,
|
|||
sock_init_data(sock, sk);
|
||||
tipc_set_sk_state(sk, TIPC_OPEN);
|
||||
if (tipc_sk_insert(tsk)) {
|
||||
sk_free(sk);
|
||||
pr_warn("Socket create failed; port number exhausted\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue