[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210412084016.311208796@linuxfoundation.org>
Date: Mon, 12 Apr 2021 10:38:34 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, =?UTF-8?q?kiyin ?= <kiyin@...cent.com>,
Xiaoming Ni <nixiaoming@...wei.com>,
"David S. Miller" <davem@...emloft.net>
Subject: [PATCH 5.11 009/210] nfc: fix memory leak in llcp_sock_connect()
From: Xiaoming Ni <nixiaoming@...wei.com>
commit 7574fcdbdcb335763b6b322f6928dc0fd5730451 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: 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>
Signed-off-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
net/nfc/llcp_sock.c | 2 ++
1 file changed, 2 insertions(+)
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -746,6 +746,8 @@ static int llcp_sock_connect(struct sock
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);
Powered by blists - more mailing lists