Skip to content

Commit 22a72c1

Browse files
ea1davisgregkh
authored andcommitted
nfc/nci: Add the inconsistency check between the input data length and count
[ Upstream commit 068648a ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent ca2b835 commit 22a72c1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

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)