diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2015-10-25 22:54:41 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2015-10-27 03:55:11 +0100 |
commit | 4e932acc6fd66c905b2d0ca452dcf69321b6c414 (patch) | |
tree | c3abce5aa1ca3901baac5b467549207d97c05f2f /drivers/nfc/st-nci | |
parent | NFC: st-nci: Increase delay between 2 secure element activations (diff) | |
download | linux-4e932acc6fd66c905b2d0ca452dcf69321b6c414.tar.xz linux-4e932acc6fd66c905b2d0ca452dcf69321b6c414.zip |
NFC: st-nci: Fix host_list verification after SE activation
A secure element can be activated in different order.
The host_list is updated keeping a fixed order:
<terminal_host_id><uicc_id><ese_id>.
Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/st-nci')
-rw-r--r-- | drivers/nfc/st-nci/se.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/nfc/st-nci/se.c b/drivers/nfc/st-nci/se.c index 3059baa0f12f..1cc24b6623e0 100644 --- a/drivers/nfc/st-nci/se.c +++ b/drivers/nfc/st-nci/se.c @@ -423,7 +423,7 @@ static int st_nci_control_se(struct nci_dev *ndev, u8 se_idx, u8 state) { struct st_nci_info *info = nci_get_drvdata(ndev); - int r; + int r, i; struct sk_buff *sk_host_list; u8 host_id; @@ -470,7 +470,10 @@ static int st_nci_control_se(struct nci_dev *ndev, u8 se_idx, if (r != NCI_HCI_ANY_OK) return r; - host_id = sk_host_list->data[sk_host_list->len - 1]; + for (i = 0; i < sk_host_list->len && + sk_host_list->data[i] != se_idx; i++) + ; + host_id = sk_host_list->data[i]; kfree_skb(sk_host_list); if (state == ST_NCI_SE_MODE_ON && host_id == se_idx) return se_idx; |