Skip to content

Commit 110b43e

Browse files
Dan Carpenterkuba-moo
authored andcommitted
NFC: nci: Add bounds checking in nci_hci_create_pipe()
The "pipe" variable is a u8 which comes from the network. If it's more than 127, then it results in memory corruption in the caller, nci_hci_connect_gate(). Cc: [email protected] Fixes: a1b0b94 ("NFC: nci: Create pipe on specific gate in nci_hci_connect_gate") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d62b04f commit 110b43e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/nfc/nci/hci.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,8 @@ static u8 nci_hci_create_pipe(struct nci_dev *ndev, u8 dest_host,
542542

543543
pr_debug("pipe created=%d\n", pipe);
544544

545+
if (pipe >= NCI_HCI_MAX_PIPES)
546+
pipe = NCI_HCI_INVALID_PIPE;
545547
return pipe;
546548
}
547549

0 commit comments

Comments
 (0)