diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2016-04-30 09:12:49 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2016-05-04 01:41:03 +0200 |
commit | 18836029d8c074ac1846167ba702ac528e0a0ad7 (patch) | |
tree | 4c4dddb66fc7ab7db4255acbd3c963d774b7d965 /net | |
parent | nfc: st21nfca: Remove duplicated ST21NFCA_ESE_HOST_ID from se.c (diff) | |
download | linux-18836029d8c074ac1846167ba702ac528e0a0ad7.tar.xz linux-18836029d8c074ac1846167ba702ac528e0a0ad7.zip |
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')
-rw-r--r-- | net/nfc/nci/core.c | 18 |
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, struct nci_core_conn_create_cmd *cmd; struct core_conn_create_data data; - if (!number_destination_params) - return -EINVAL; - data.length = params_len + sizeof(struct nci_core_conn_create_cmd); cmd = kzalloc(data.length, GFP_KERNEL); if (!cmd) @@ -620,17 +617,20 @@ int nci_core_conn_create(struct nci_dev *ndev, u8 destination_type, cmd->destination_type = destination_type; cmd->number_destination_params = number_destination_params; - memcpy(cmd->params, params, params_len); data.cmd = cmd; - if (params->length > 0) - ndev->cur_id = params->value[DEST_SPEC_PARAMS_ID_INDEX]; - else + if (params) { + memcpy(cmd->params, params, params_len); + if (params->length > 0) + ndev->cur_id = params->value[DEST_SPEC_PARAMS_ID_INDEX]; + else + ndev->cur_id = 0; + } else { ndev->cur_id = 0; + } - r = __nci_request(ndev, nci_core_conn_create_req, - (unsigned long)&data, + r = __nci_request(ndev, nci_core_conn_create_req, (unsigned long)&data, msecs_to_jiffies(NCI_CMD_TIMEOUT)); kfree(cmd); return r; |