diff options
| author | David S. Miller <davem@davemloft.net> | 2020-03-12 21:29:30 -0700 | 
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2020-03-12 22:34:48 -0700 | 
| commit | 1d343579312311aa9875b34d5a921f5e2ec69f0a (patch) | |
| tree | 64b636b5557d92f5266187f035dac34862db86d5 /net/nfc/hci | |
| parent | a8eceea84a3a3504e42f6495cf462027c5d19cb0 (diff) | |
| parent | 0d81a3f29c0afb18ba2b1275dcccf21e0dd4da38 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Minor overlapping changes, nothing serious.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/nfc/hci')
| -rw-r--r-- | net/nfc/hci/core.c | 19 | 
1 files changed, 16 insertions, 3 deletions
| diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index 6f1b096e601c..43811b5219b5 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c @@ -181,13 +181,20 @@ exit:  void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,  			  struct sk_buff *skb)  { -	u8 gate = hdev->pipes[pipe].gate;  	u8 status = NFC_HCI_ANY_OK;  	struct hci_create_pipe_resp *create_info;  	struct hci_delete_pipe_noti *delete_info;  	struct hci_all_pipe_cleared_noti *cleared_info; +	u8 gate; -	pr_debug("from gate %x pipe %x cmd %x\n", gate, pipe, cmd); +	pr_debug("from pipe %x cmd %x\n", pipe, cmd); + +	if (pipe >= NFC_HCI_MAX_PIPES) { +		status = NFC_HCI_ANY_E_NOK; +		goto exit; +	} + +	gate = hdev->pipes[pipe].gate;  	switch (cmd) {  	case NFC_HCI_ADM_NOTIFY_PIPE_CREATED: @@ -375,8 +382,14 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,  			    struct sk_buff *skb)  {  	int r = 0; -	u8 gate = hdev->pipes[pipe].gate; +	u8 gate; + +	if (pipe >= NFC_HCI_MAX_PIPES) { +		pr_err("Discarded event %x to invalid pipe %x\n", event, pipe); +		goto exit; +	} +	gate = hdev->pipes[pipe].gate;  	if (gate == NFC_HCI_INVALID_GATE) {  		pr_err("Discarded event %x to unopened pipe %x\n", event, pipe);  		goto exit; | 
