Skip to content

Commit 068648a

Browse files
ea1davisdavem330
authored andcommitted
nfc/nci: Add the inconsistency check between the input data length and count
write$nci(r0, &(0x7f0000000740)=ANY=[@ANYBLOB="610501"], 0xf) Syzbot constructed a write() call with a data length of 3 bytes but a count value of 15, which passed too little data to meet the basic requirements of the function nci_rf_intf_activated_ntf_packet(). Therefore, increasing the comparison between data length and count value to avoid problems caused by inconsistent data length and count. Reported-and-tested-by: [email protected] Signed-off-by: Edward Adam Davis <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e9022b3 commit 068648a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/nfc/virtual_ncidev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ static ssize_t virtual_ncidev_write(struct file *file,
125125
kfree_skb(skb);
126126
return -EFAULT;
127127
}
128+
if (strnlen(skb->data, count) != count) {
129+
kfree_skb(skb);
130+
return -EINVAL;
131+
}
128132

129133
nci_recv_frame(vdev->ndev, skb);
130134
return count;

0 commit comments

Comments
 (0)