From: Johan Hedberg Date: Tue, 18 Feb 2014 19:41:35 +0000 (+0200) Subject: Bluetooth: Don't try to look up private addresses as Identity Address X-Git-Tag: accepted/tizen/common/20141203.182822~316^2~18^2^2~46^2~123 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6cfc9988bd3e5d2931365da76db9b5a7334494b6;p=platform%2Fkernel%2Flinux-arm64.git Bluetooth: Don't try to look up private addresses as Identity Address Identity Addresses are either public or static random. When looking up addresses based on the Identity Address it doesn't make sense to go through the IRK list if we're given a private random address. This patch fixes (or rather improves) the hci_find_irk_by_addr function to bail out early if given a private random address. Signed-off-by: Johan Hedberg Signed-off-by: Marcel Holtmann --- diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index cdba470..e4c5b9d 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2662,6 +2662,10 @@ struct smp_irk *hci_find_irk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, { struct smp_irk *irk; + /* Identity Address must be public or static random */ + if (addr_type == ADDR_LE_DEV_RANDOM && (bdaddr->b[5] & 0xc0) != 0xc0) + return NULL; + list_for_each_entry(irk, &hdev->identity_resolving_keys, list) { if (addr_type == irk->addr_type && bacmp(bdaddr, &irk->bdaddr) == 0)