]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: Fix IRK lookup when tfm_aes is not available
authorJohan Hedberg <johan.hedberg@intel.com>
Fri, 8 Aug 2014 06:32:49 +0000 (09:32 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 14 Aug 2014 06:49:16 +0000 (08:49 +0200)
If the AES crypto has not been initialized properly we should cleanly
return from the hci_find_irk_by_rpa() function. Right now this will not
happen in practice, but once (in subsequent patches) SMP init is moved
to after the HCI init procedure it is possible that the pointer is NULL.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_core.c

index 860477090d78426b2333443ba8c4990a37237960..4a1ec259099ed75396c0190655afed55a4a4fdb4 100644 (file)
@@ -3232,6 +3232,9 @@ struct smp_irk *hci_find_irk_by_rpa(struct hci_dev *hdev, bdaddr_t *rpa)
                        return irk;
        }
 
+       if (!hdev->tfm_aes)
+               return NULL;
+
        list_for_each_entry(irk, &hdev->identity_resolving_keys, list) {
                if (smp_irk_matches(hdev->tfm_aes, irk->val, rpa)) {
                        bacpy(&irk->rpa, rpa);