drivers/contactless/pn532: Fix Stack Overflow in PN532 Contactless Dr…#19132
Merged
xiaoxiang781216 merged 1 commit intoJun 14, 2026
Conversation
…iver When calling Set RF Configuration command, a compromised user process can trigger memory corruption in the kernel. This can lead to a system crash or potentially arbitrary code execution in the kernel. It addresses an earlier incomplete fix. Tested locally. Signed-off-by: Your Name <catalin_visinescu@yahoo.com>
xiaoxiang781216
approved these changes
Jun 13, 2026
acassis
approved these changes
Jun 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
drivers/contactless/pn532: Fix Stack Overflow in PN532 Contactless Driver
It addresses an earlier incomplete fix.
Tested locally, builds fine, simple fix.
Summary
The PN532 driver contains a buffer overflow, in ioctl . Untrusted content is given to the
device in arg :
The RF Configuration command is described in Section 7.3.1 of the PN532 user guide (https://www.nxp.com/docs/en/user-guide/141520.pdf).
In the following structure conf is untrusted. The frame pointer
fuses thecmd_bufferforstorage and the maximum
datasize it can write is 16 bytes (because the first 6 bytes areused by
preambletotfi). Note however that attacker controlledconf->data_sizelength is used to write attacker controlled contentconf->configinto kernel stack memory, and maybe able to cause a privilege escalation.
Impact
When calling Set RF Configuration command, a compromised user process can trigger memory corruption in the kernel. This can lead to a system crash or potentially arbitrary code execution in the kernel.
Testing
Tested locally, after changes made with menuconfig to include the contactless driver in the build:
Signed-off-by: Catalin Visinescu catalin_visinescu@yahoo.com