summaryrefslogtreecommitdiff
path: root/net/nfc
diff options
context:
space:
mode:
authorXiaoming Ni <nixiaoming@huawei.com>2021-03-25 11:51:12 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-16 11:57:47 +0200
commit02b99cae71335f9f38d0a164ffe3a7a1328f44fc (patch)
treee61e762df8e3430eeac5d3230e9ef47cfe270074 /net/nfc
parentb1d5c07a3b597766bbf5bf61083cd65e72034144 (diff)
downloadlinux-rt-02b99cae71335f9f38d0a164ffe3a7a1328f44fc.tar.gz
nfc: fix memory leak in llcp_sock_connect()
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@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>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/llcp_sock.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index 050f80d524f8..413544ebe8ef 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -758,6 +758,8 @@ sock_unlink:
nfc_llcp_local_put(llcp_sock->local);
nfc_llcp_sock_unlink(&local->connecting_sockets, sk);
+ kfree(llcp_sock->service_name);
+ llcp_sock->service_name = NULL;
put_dev:
nfc_put_device(dev);