Re: [syzbot] [nfc?] [net?] KMSAN: uninit-value in nci_ntf_packet (2)

From: Edward Adam Davis
Date: Mon May 27 2024 - 22:15:15 EST


please test uv in nci_ntf_packet

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 614da38e2f7a

diff --git a/drivers/nfc/virtual_ncidev.c b/drivers/nfc/virtual_ncidev.c
index 590b038e449e..6b89d596ba9a 100644
--- a/drivers/nfc/virtual_ncidev.c
+++ b/drivers/nfc/virtual_ncidev.c
@@ -125,6 +125,10 @@ 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;