Thread (14 messages) flat view 14 messages, 4 authors, 2021-03-26
STALE1988d

Revision resend of 2 in this series.

Revisions (2)
  1. v1 [diff vs current]
  2. resend current

[PATCH resend 3/4] nfc: fix memory leak in llcp_sock_connect()

From: Xiaoming Ni <hidden>
Date: 2021-03-25 03:52:09
Also in: lkml, stable
Subsystem: networking [general], nfc subsystem, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Heidelberg, Linus Torvalds

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: d646960f7986 ("NFC: Initial LLCP support")
Reported-by: "kiyin(尹亮)" <redacted>
Link: https://www.openwall.com/lists/oss-security/2020/11/01/1
Cc: <redacted> #v3.3
Signed-off-by: Xiaoming Ni <redacted>
---
 net/nfc/llcp_sock.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index 9e2799ee1595..59172614b249 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -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);
-- 
2.27.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help