drivers/contactless: fix uninitialized uid leak in mfrc522_read#19419
Merged
Conversation
Fix security issue where uninitialized kernel stack contents could be leaked to userspace when mfrc522_picc_select() fails. In mfrc522_read(), the local variable 'uid' was not initialized before being passed to mfrc522_picc_select(). If the function fails (e.g., due to bad data on the SPI bus), the uninitialized uid.sak value could pass the PICC_TYPE_NOT_COMPLETE check, causing snprintf() to copy uninitialized kernel stack data to the userspace buffer. Fixes apache#19417 Signed-off-by: hanzhijian <hanzhijian@zepp.com> Author: hanzhijian <hanzhijian@zepp.com>
xiaoxiang781216
approved these changes
Jul 13, 2026
jerpelea
approved these changes
Jul 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.
Summary
Fix security issue where uninitialized kernel stack contents could be leaked to userspace when
mfrc522_picc_select()fails.In
mfrc522_read(), the local variableuidwas not initialized before being passed tomfrc522_picc_select(). If the function fails (e.g., due to bad data on the SPI bus), the uninitializeduid.sakvalue could pass thePICC_TYPE_NOT_COMPLETEcheck, causingsnprintf()to copy uninitialized kernel stack data to the userspace buffer.Fixes #19417
Impact
mfrc522_picc_select()Testing
Signed-off-by: hanzhijian hanzhijian@zepp.com