aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2016-04-30 03:12:49 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2016-05-03 19:41:03 -0400
commit18836029d8c074ac1846167ba702ac528e0a0ad7 (patch)
tree4c4dddb66fc7ab7db4255acbd3c963d774b7d965 /net/nfc
parent99adc394f2a4a16763bccbaa150b9d598b18c58f (diff)
nfc: nci: Fix nci_core_conn_create to allowing empty destination
NCI_CORE_CONN_CREATE may not have any destination type parameter. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/nci/core.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index fbb7a2b57b44..031ac0f9538c 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -610,9 +610,6 @@ int nci_core_conn_create(struct nci_dev *ndev, u8 destination_type,
610 struct nci_core_conn_create_cmd *cmd; 610 struct nci_core_conn_create_cmd *cmd;
611 struct core_conn_create_data data; 611 struct core_conn_create_data data;
612 612
613 if (!number_destination_params)
614 return -EINVAL;
615
616 data.length = params_len + sizeof(struct nci_core_conn_create_cmd); 613 data.length = params_len + sizeof(struct nci_core_conn_create_cmd);
617 cmd = kzalloc(data.length, GFP_KERNEL); 614 cmd = kzalloc(data.length, GFP_KERNEL);
618 if (!cmd) 615 if (!cmd)
@@ -620,17 +617,20 @@ int nci_core_conn_create(struct nci_dev *ndev, u8 destination_type,
620 617
621 cmd->destination_type = destination_type; 618 cmd->destination_type = destination_type;
622 cmd->number_destination_params = number_destination_params; 619 cmd->number_destination_params = number_destination_params;
623 memcpy(cmd->params, params, params_len);
624 620
625 data.cmd = cmd; 621 data.cmd = cmd;
626 622
627 if (params->length > 0) 623 if (params) {
628 ndev->cur_id = params->value[DEST_SPEC_PARAMS_ID_INDEX]; 624 memcpy(cmd->params, params, params_len);
629 else 625 if (params->length > 0)
626 ndev->cur_id = params->value[DEST_SPEC_PARAMS_ID_INDEX];
627 else
628 ndev->cur_id = 0;
629 } else {
630 ndev->cur_id = 0; 630 ndev->cur_id = 0;
631 }
631 632
632 r = __nci_request(ndev, nci_core_conn_create_req, 633 r = __nci_request(ndev, nci_core_conn_create_req, (unsigned long)&data,
633 (unsigned long)&data,
634 msecs_to_jiffies(NCI_CMD_TIMEOUT)); 634 msecs_to_jiffies(NCI_CMD_TIMEOUT));
635 kfree(cmd); 635 kfree(cmd);
636 return r; 636 return r;