Skip to content

Commit

Permalink
nfc: fix memory leak in llcp_sock_connect()
Browse files Browse the repository at this point in the history
commit 7574fcd upstream.

In llcp_sock_connect(), use kmemdup to allocate memory for
 "llcp_sock->service_name". The memory is not released in the sock_unlink
label of the subsequent failure branch.
As a result, memory leakage occurs.

fix CVE-2020-25672

Fixes: d646960 ("NFC: Initial LLCP support")
Reported-by: "kiyin(尹亮)" <kiyin@tencent.com>
Link: https://www.openwall.com/lists/oss-security/2020/11/01/1
Cc: <stable@vger.kernel.org> #v3.3
Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
nixiaoming authored and gregkh committed Apr 14, 2021
1 parent 99b5961 commit 568ac94
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/nfc/llcp_sock.c
Expand Up @@ -746,6 +746,8 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,

sock_unlink:
nfc_llcp_sock_unlink(&local->connecting_sockets, sk);
kfree(llcp_sock->service_name);
llcp_sock->service_name = NULL;

sock_llcp_release:
nfc_llcp_put_ssap(local, llcp_sock->ssap);
Expand Down

0 comments on commit 568ac94

Please sign in to comment.