diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2019-04-03 10:13:51 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-16 19:42:32 +0200 |
commit | 801b0f2624848e924de35870d2918aa72d26210b (patch) | |
tree | 08b897f4f8695e217210cbba671e169199b7aa2b /include | |
parent | 205db528f3ae1b6bb534f05a64c0c166f95a01d2 (diff) | |
download | linux-stable-801b0f2624848e924de35870d2918aa72d26210b.tar.gz linux-stable-801b0f2624848e924de35870d2918aa72d26210b.tar.bz2 linux-stable-801b0f2624848e924de35870d2918aa72d26210b.zip |
nfc: nci: Potential off by one in ->pipes[] array
[ Upstream commit 6491d698396fd5da4941980a35ca7c162a672016 ]
This is similar to commit e285d5bfb7e9 ("NFC: Fix the number of pipes")
where we changed NFC_HCI_MAX_PIPES from 127 to 128.
As the comment next to the define explains, the pipe identifier is 7
bits long. The highest possible pipe is 127, but the number of possible
pipes is 128. As the code is now, then there is potential for an
out of bounds array access:
net/nfc/nci/hci.c:297 nci_hci_cmd_received() warn: array off by one?
'ndev->hci_dev->pipes[pipe]' '0-127 == 127'
Fixes: 11f54f228643 ("NFC: nci: Add HCI over NCI protocol support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/nfc/nci_core.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h index 87499b6b35d6..df5c69db68af 100644 --- a/include/net/nfc/nci_core.h +++ b/include/net/nfc/nci_core.h @@ -166,7 +166,7 @@ struct nci_conn_info { * According to specification 102 622 chapter 4.4 Pipes, * the pipe identifier is 7 bits long. */ -#define NCI_HCI_MAX_PIPES 127 +#define NCI_HCI_MAX_PIPES 128 struct nci_hci_gate { u8 gate; |