[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210325035113.49323-3-nixiaoming@huawei.com>
Date: Thu, 25 Mar 2021 11:51:11 +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 resend 2/4] nfc: fix refcount leak in llcp_sock_connect()
nfc_llcp_local_get() is invoked in llcp_sock_connect(),
but nfc_llcp_local_put() is not invoked in subsequent failure branches.
As a result, refcount leakage occurs.
To fix it, add calling nfc_llcp_local_put().
fix CVE-2020-25671
Fixes: c7aa12252f51 ("NFC: Take a reference on the LLCP local pointer when
creating a socket")
Reported-by: "kiyin(尹亮)" <kiyin@...cent.com>
Link: https://www.openwall.com/lists/oss-security/2020/11/01/1
Cc: <stable@...r.kernel.org> #v3.6
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 68832ee4b9f8..9e2799ee1595 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -704,6 +704,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
llcp_sock->local = nfc_llcp_local_get(local);
llcp_sock->ssap = nfc_llcp_get_local_ssap(local);
if (llcp_sock->ssap == LLCP_SAP_MAX) {
+ nfc_llcp_local_put(llcp_sock->local);
ret = -ENOMEM;
goto put_dev;
}
@@ -748,6 +749,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
sock_llcp_release:
nfc_llcp_put_ssap(local, llcp_sock->ssap);
+ nfc_llcp_local_put(llcp_sock->local);
put_dev:
nfc_put_device(dev);
--
2.27.0
Powered by blists - more mailing lists