Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NFC: st21nfca: Fix host_list verification after SEactivation

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>

authored by

Christophe Ricard and committed by
Samuel Ortiz
cde2aa99 4e932acc

+5 -2
+5 -2
drivers/nfc/st21nfca/se.c
··· 100 100 u8 state) 101 101 { 102 102 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); 103 - int r; 103 + int r, i; 104 104 struct sk_buff *sk_host_list; 105 105 u8 se_event, host_id; 106 106 ··· 148 148 if (r < 0) 149 149 return r; 150 150 151 - host_id = sk_host_list->data[sk_host_list->len - 1]; 151 + for (i = 0; i < sk_host_list->len && 152 + sk_host_list->data[i] != se_idx; i++) 153 + ; 154 + host_id = sk_host_list->data[i]; 152 155 kfree_skb(sk_host_list); 153 156 154 157 if (state == ST21NFCA_SE_MODE_ON && host_id == se_idx)