Skip to content

Commit 7574fcd

Browse files
nixiaomingdavem330
authored andcommitted
nfc: fix memory leak in llcp_sock_connect()
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(尹亮)" <[email protected]> Link: https://www.openwall.com/lists/oss-security/2020/11/01/1 Cc: <[email protected]> #v3.3 Signed-off-by: Xiaoming Ni <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8a4cd82 commit 7574fcd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/nfc/llcp_sock.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
746746

747747
sock_unlink:
748748
nfc_llcp_sock_unlink(&local->connecting_sockets, sk);
749+
kfree(llcp_sock->service_name);
750+
llcp_sock->service_name = NULL;
749751

750752
sock_llcp_release:
751753
nfc_llcp_put_ssap(local, llcp_sock->ssap);

0 commit comments

Comments
 (0)