From: Anderson Briglia Date: Mon, 21 Feb 2011 18:09:23 +0000 (-0300) Subject: Bluetooth: Fix LE conn creation X-Git-Tag: v2.6.39-rc1~468^2~25^2^2~67^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=15c4794fe247d85ce38eb5f5e2a5855d996f56cd;p=platform%2Fkernel%2Flinux-stable.git Bluetooth: Fix LE conn creation This patch prevents a crash when remote host tries to create a LE link which already exists. i.e.: call l2test twice passing the same parameters. Signed-off-by: Anderson Briglia Signed-off-by: Ville Tervo Signed-off-by: Gustavo F. Padovan --- diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 6d8b988..4504cb6 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -430,8 +430,9 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 if (type == LE_LINK) { le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst); - if (!le) - le = hci_conn_add(hdev, LE_LINK, dst); + if (le) + return NULL; + le = hci_conn_add(hdev, LE_LINK, dst); if (!le) return NULL; if (le->state == BT_OPEN)