Skip to contentSkip to conversation

Revert "nfc/nci: Add the inconsistency check between the input data length and count"

PATCH Applied Thadeu Lima de Souza Cascardo 2 participants 2 messages Jan 13 – Jan 19

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "nfc/nci: Add the inconsistency check between the input data length and count"

This reverts commit 068648aab72c9ba7b0597354ef4d81ffaac7b979.

NFC packets may have NUL-bytes. Checking for string length is not a correct assumption here. As long as there is a check for the length copied from copy_from_user, all should be fine.

The fix only prevented the syzbot reproducer from triggering the bug because the packet is not enqueued anymore and the code that triggers the bug is not exercised.

The fix even broke
testing/selftests/nci/nci_dev, making all tests there fail. After the revert, 6 out of 8 tests pass.

Fixes 068648aab72c ("nfc/nci: Add the inconsistency check between the input data length and count")
---
 drivers/nfc/virtual_ncidev.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/nfc/virtual_ncidev.c +0 -4
index 9ef8ef2d4363..b957fce83b7c 100644
@@ -125,10 +125,6 @@ static ssize_t virtual_ncidev_write(struct file *file,
 		kfree_skb(skb);
 		return -EFAULT;
 	}
-	if (strnlen(skb->data, count) != count) {
-		kfree_skb(skb);
-		return -EINVAL;
-	}
 
 	nci_recv_frame(vdev->ndev, skb);
 	return count;
Signature · 1 line
2.47.3
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Tue, 13 Jan 2026 17:24:58 -0300 you wrote:

This reverts commit 068648aab72c9ba7b0597354ef4d81ffaac7b979.

NFC packets may have NUL-bytes. Checking for string length is not a correct assumption here. As long as there is a check for the length copied from copy_from_user, all should be fine.

The fix only prevented the syzbot reproducer from triggering the bug because the packet is not enqueued anymore and the code that triggers the bug is not exercised.

[...]

Here is the summary with links:
- [net] Revert "nfc/nci: Add the inconsistency check between the input data length and count"

    https://git.kernel.org/netdev/net/c/f40ddcc0c0ca

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html