[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210303061654.127666-4-nixiaoming@huawei.com>
Date: Wed, 3 Mar 2021 14:16:53 +0800
From: Xiaoming Ni <nixiaoming@...wei.com>
To: <linux-kernel@...r.kernel.org>, <kiyin@...cent.com>,
<stable@...r.kernel.org>, <gregkh@...uxfoundation.org>,
<sameo@...ux.intel.com>, <linville@...driver.com>,
<davem@...emloft.net>, <kuba@...nel.org>, <mkl@...gutronix.de>,
<stefan@...enfreihafen.org>, <matthieu.baerts@...sares.net>,
<netdev@...r.kernel.org>
CC: <nixiaoming@...wei.com>, <wangle6@...wei.com>,
<xiaoqian9@...wei.com>
Subject: [PATCH 3/4] 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: d646960f7986 ("NFC: Initial LLCP support")
Reported-by: "kiyin(尹亮)" <kiyin@...cent.com>
Link: https://www.openwall.com/lists/oss-security/2020/11/01/1
Cc: <stable@...r.kernel.org> #v3.3
Signed-off-by: Xiaoming Ni <nixiaoming@...wei.com>
---
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
Powered by blists - more mailing lists