提交 322a5755 编写于 作者: D Dan Carpenter 提交者: Greg Kroah-Hartman

nfc: nci: Potential off by one in ->pipes[] array

[ Upstream commit 6491d698396fd5da4941980a35ca7c162a672016 ]

This is similar to commit e285d5bf ("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: 11f54f22 ("NFC: nci: Add HCI over NCI protocol support")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <alexander.levin@microsoft.com>
上级 f5e60565
...@@ -166,7 +166,7 @@ struct nci_conn_info { ...@@ -166,7 +166,7 @@ struct nci_conn_info {
* According to specification 102 622 chapter 4.4 Pipes, * According to specification 102 622 chapter 4.4 Pipes,
* the pipe identifier is 7 bits long. * the pipe identifier is 7 bits long.
*/ */
#define NCI_HCI_MAX_PIPES 127 #define NCI_HCI_MAX_PIPES 128
struct nci_hci_gate { struct nci_hci_gate {
u8 gate; u8 gate;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册