From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Lin Ma <linma@zju.edu.cn>,
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>,
kuba@kernel.org, bongsu.jeon@samsung.com, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 05/11] nfc: nci: fix the UAF of rf_conn_info object
Date: Wed, 20 Oct 2021 20:22:31 -0400 [thread overview]
Message-ID: <20211021002238.1129482-5-sashal@kernel.org> (raw)
In-Reply-To: <20211021002238.1129482-1-sashal@kernel.org>
From: Lin Ma <linma@zju.edu.cn>
[ Upstream commit 1b1499a817c90fd1ce9453a2c98d2a01cca0e775 ]
The nci_core_conn_close_rsp_packet() function will release the conn_info
with given conn_id. However, it needs to set the rf_conn_info to NULL to
prevent other routines like nci_rf_intf_activated_ntf_packet() to trigger
the UAF.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Lin Ma <linma@zju.edu.cn>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/nfc/nci/rsp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index a48297b79f34..b0ed2b47ac43 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -277,6 +277,8 @@ static void nci_core_conn_close_rsp_packet(struct nci_dev *ndev,
ndev->cur_conn_id);
if (conn_info) {
list_del(&conn_info->list);
+ if (conn_info == ndev->rf_conn_info)
+ ndev->rf_conn_info = NULL;
devm_kfree(&ndev->nfc_dev->dev, conn_info);
}
}
--
2.33.0
next prev parent reply other threads:[~2021-10-21 0:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 0:22 [PATCH AUTOSEL 5.4 01/11] gcc-plugins/structleak: add makefile var for disabling structleak Sasha Levin
2021-10-21 0:22 ` [PATCH AUTOSEL 5.4 02/11] btrfs: deal with errors when checking if a dir entry exists during log replay Sasha Levin
2021-10-21 0:22 ` [PATCH AUTOSEL 5.4 03/11] net: stmmac: add support for dwmac 3.40a Sasha Levin
2021-10-21 0:22 ` [PATCH AUTOSEL 5.4 04/11] ARM: dts: spear3xx: Fix gmac node Sasha Levin
2021-10-21 0:22 ` Sasha Levin [this message]
2021-10-21 0:22 ` [PATCH AUTOSEL 5.4 06/11] isdn: cpai: check ctr->cnr to avoid array index out of bound Sasha Levin
2021-10-21 0:22 ` [PATCH AUTOSEL 5.4 07/11] isdn: mISDN: Fix sleeping function called from invalid context Sasha Levin
2021-10-21 0:22 ` [PATCH AUTOSEL 5.4 08/11] platform/x86: intel_scu_ipc: Update timeout value in comment Sasha Levin
2021-10-21 0:22 ` [PATCH AUTOSEL 5.4 09/11] ALSA: hda: avoid write to STATESTS if controller is in reset Sasha Levin
2021-10-21 0:22 ` [PATCH AUTOSEL 5.4 10/11] Input: snvs_pwrkey - add clk handling Sasha Levin
2021-10-21 0:22 ` [PATCH AUTOSEL 5.4 11/11] Input: xpad - add support for another USB ID of Nacon GC-100 Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211021002238.1129482-5-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=bongsu.jeon@samsung.com \
--cc=davem@davemloft.net \
--cc=krzysztof.kozlowski@canonical.com \
--cc=kuba@kernel.org \
--cc=linma@zju.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).