From: Johan Hedberg Date: Tue, 25 Feb 2014 20:24:37 +0000 (+0200) Subject: Bluetooth: Ignore IRKs with no Identity Address X-Git-Tag: v4.0~1503^2~11^2~7^2~45^2~126 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9a58f861218aee89fbe8ed4db054a7eee6f58c2;p=platform%2Fkernel%2Flinux-amlogic.git Bluetooth: Ignore IRKs with no Identity Address The Core Specification (4.1) leaves room for sending an SMP Identity Address Information PDU with an all-zeros BD_ADDR value. This essentially means that we would not have an Identity Address for the device and the only means of identifying it would be the IRK value itself. Due to lack of any known implementations behaving like this it's best to keep our implementation as simple as possible as far as handling such situations is concerned. This patch updates the Identity Address Information handler function to simply ignore the IRK received from such a device. Signed-off-by: Johan Hedberg Signed-off-by: Marcel Holtmann --- diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 79a80f4..50355d0 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -1003,6 +1003,19 @@ static int smp_cmd_ident_addr_info(struct l2cap_conn *conn, skb_pull(skb, sizeof(*info)); + /* Strictly speaking the Core Specification (4.1) allows sending + * an empty address which would force us to rely on just the IRK + * as "identity information". However, since such + * implementations are not known of and in order to not over + * complicate our implementation, simply pretend that we never + * received an IRK for such a device. + */ + if (!bacmp(&info->bdaddr, BDADDR_ANY)) { + BT_ERR("Ignoring IRK with no identity address"); + smp_distribute_keys(conn, 1); + return 0; + } + bacpy(&smp->id_addr, &info->bdaddr); smp->id_addr_type = info->addr_type;