From: Hangyu Hua <hbh25y@gmail.com>
To: krzysztof.kozlowski@linaro.org, sameo@linux.intel.com,
christophe.ricard@gmail.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Hangyu Hua <hbh25y@gmail.com>
Subject: [PATCH] nfc: st21nfca: fix possible double free in st21nfca_im_recv_dep_res_cb()
Date: Wed, 22 Jun 2022 14:51:17 +0800 [thread overview]
Message-ID: <20220622065117.23210-1-hbh25y@gmail.com> (raw)
nfc_tm_data_received will free skb internally when it fails. There is no
need to free skb in st21nfca_im_recv_dep_res_cb again.
Fix this by setting skb to NULL when nfc_tm_data_received fails.
Fixes: 1892bf844ea0 ("NFC: st21nfca: Adding P2P support to st21nfca in Initiator & Target mode")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
drivers/nfc/st21nfca/dep.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nfc/st21nfca/dep.c b/drivers/nfc/st21nfca/dep.c
index 1ec651e31064..07ac5688011c 100644
--- a/drivers/nfc/st21nfca/dep.c
+++ b/drivers/nfc/st21nfca/dep.c
@@ -594,7 +594,8 @@ static void st21nfca_im_recv_dep_res_cb(void *context, struct sk_buff *skb,
ST21NFCA_NFC_DEP_PFB_PNI(dep_res->pfb + 1);
size++;
skb_pull(skb, size);
- nfc_tm_data_received(info->hdev->ndev, skb);
+ if (nfc_tm_data_received(info->hdev->ndev, skb))
+ skb = NULL;
break;
case ST21NFCA_NFC_DEP_PFB_SUPERVISOR_PDU:
pr_err("Received a SUPERVISOR PDU\n");
--
2.25.1
next reply other threads:[~2022-06-22 6:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-22 6:51 Hangyu Hua [this message]
2022-06-23 9:42 ` Paolo Abeni
2022-06-23 10:47 ` Hangyu Hua
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=20220622065117.23210-1-hbh25y@gmail.com \
--to=hbh25y@gmail.com \
--cc=christophe.ricard@gmail.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sameo@linux.intel.com \
/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
all inboxes | Powered by JetHome®