2011-02-21 18:09:23

by Anderson Briglia

[permalink] [raw]
Subject: [PATCH 1/2] Bluetooth: Fix LE conn creation

From: Anderson Briglia <[email protected]>

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 <[email protected]>
Signed-off-by: Ville Tervo <[email protected]>
---
net/bluetooth/hci_conn.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index a050a69..d401775 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -429,8 +429,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)
--
1.7.1



2011-02-21 21:00:45

by Gustavo Padovan

[permalink] [raw]
Subject: Re: [PATCH 1/2] Bluetooth: Fix LE conn creation

Hi Briglia,

* [email protected] <[email protected]> [2011-02-21 15:09:23 -0300]:

> From: Anderson Briglia <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: Ville Tervo <[email protected]>
> ---
> net/bluetooth/hci_conn.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)

Applied, thanks.

--
Gustavo F. Padovan
http://profusion.mobi