Commit 15c4794fe247d85ce38eb5f5e2a5855d996f56cd

Authored by Anderson Briglia
Committed by Gustavo F. Padovan
1 parent a664b5bc77

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 <anderson.briglia@openbossa.org>
Signed-off-by: Ville Tervo <ville.tervo@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

net/bluetooth/hci_conn.c
... ... @@ -430,8 +430,9 @@
430 430  
431 431 if (type == LE_LINK) {
432 432 le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
433   - if (!le)
434   - le = hci_conn_add(hdev, LE_LINK, dst);
  433 + if (le)
  434 + return NULL;
  435 + le = hci_conn_add(hdev, LE_LINK, dst);
435 436 if (!le)
436 437 return NULL;
437 438 if (le->state == BT_OPEN)