* [PATCH net-next] nfc: pn533: prevent potential memory corruption
@ 2021-04-02 11:44 Dan Carpenter
2021-04-02 21:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-04-02 11:44 UTC (permalink / raw)
To: Jakub Kicinski, Samuel Ortiz
Cc: Jakub Kicinski, John W. Linville, netdev, kernel-janitors
If the "type_a->nfcid_len" is too large then it would lead to memory
corruption in pn533_target_found_type_a() when we do:
memcpy(nfc_tgt->nfcid1, tgt_type_a->nfcid_data, nfc_tgt->nfcid1_len);
Fixes: c3b1e1e8a76f ("NFC: Export NFCID1 from pn533")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/nfc/pn533/pn533.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
index f1469ac8ff42..3fe5b81eda2d 100644
--- a/drivers/nfc/pn533/pn533.c
+++ b/drivers/nfc/pn533/pn533.c
@@ -706,6 +706,9 @@ static bool pn533_target_type_a_is_valid(struct pn533_target_type_a *type_a,
if (PN533_TYPE_A_SEL_CASCADE(type_a->sel_res) != 0)
return false;
+ if (type_a->nfcid_len > NFC_NFCID1_MAXSIZE)
+ return false;
+
return true;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] nfc: pn533: prevent potential memory corruption
2021-04-02 11:44 [PATCH net-next] nfc: pn533: prevent potential memory corruption Dan Carpenter
@ 2021-04-02 21:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-02 21:30 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kuba, sameo, linville, netdev, kernel-janitors
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Fri, 2 Apr 2021 14:44:42 +0300 you wrote:
> If the "type_a->nfcid_len" is too large then it would lead to memory
> corruption in pn533_target_found_type_a() when we do:
>
> memcpy(nfc_tgt->nfcid1, tgt_type_a->nfcid_data, nfc_tgt->nfcid1_len);
>
> Fixes: c3b1e1e8a76f ("NFC: Export NFCID1 from pn533")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> [...]
Here is the summary with links:
- [net-next] nfc: pn533: prevent potential memory corruption
https://git.kernel.org/netdev/net-next/c/ca4d4c34ae9a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-02 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 11:44 [PATCH net-next] nfc: pn533: prevent potential memory corruption Dan Carpenter
2021-04-02 21:30 ` patchwork-bot+netdevbpf
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).