All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] android/bluetooth: Fix handling paring related events
@ 2014-09-02 11:51 Lukasz Rymanowski
  2014-09-02 15:43 ` Szymon Janc
  0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Rymanowski @ 2014-09-02 11:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lukasz Rymanowski

As it turns out it is possible that kernel send to user space mgmt
events related to pairing before device connected event.
In such case BfA was dropping such event because he does not know
device.

With this patch, if device is not in the cache, BfA will create it.

Issue triggered by test: "Bluetooth Accept Bond - Just Works - Success"
---
v2: build error.
 android/bluetooth.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 99e2aab..bd1e747 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1240,7 +1240,7 @@ static void new_link_key_callback(uint16_t index, uint16_t length,
 		return;
 	}
 
-	dev = find_device(&ev->key.addr.bdaddr);
+	dev = get_device(&ev->key.addr.bdaddr, ev->key.addr.type);
 	if (!dev)
 		return;
 
@@ -1335,7 +1335,7 @@ static void user_confirm_request_callback(uint16_t index, uint16_t length,
 	ba2str(&ev->addr.bdaddr, dst);
 	DBG("%s confirm_hint %u", dst, ev->confirm_hint);
 
-	dev = find_device(&ev->addr.bdaddr);
+	dev = get_device(&ev->addr.bdaddr, ev->addr.type);
 	if (!dev)
 		return;
 
@@ -1363,7 +1363,7 @@ static void user_passkey_request_callback(uint16_t index, uint16_t length,
 	ba2str(&ev->addr.bdaddr, dst);
 	DBG("%s", dst);
 
-	dev = find_device(&ev->addr.bdaddr);
+	dev = get_device(&ev->addr.bdaddr, ev->addr.type);
 	if (!dev)
 		return;
 
@@ -2288,7 +2288,7 @@ static void new_csrk_callback(uint16_t index, uint16_t length,
 	}
 
 	ba2str(&ev->key.addr.bdaddr, dst);
-	dev = find_device(&ev->key.addr.bdaddr);
+	dev = get_device(&ev->key.addr.bdaddr, ev->key.addr.type);
 	if (!dev)
 		return;
 
@@ -2363,7 +2363,7 @@ static void new_irk_callback(uint16_t index, uint16_t length,
 	DBG("new IRK for %s, RPA %s", dst, rpa);
 
 	if (!bacmp(&ev->rpa, BDADDR_ANY)) {
-		dev = find_device(&addr->bdaddr);
+		dev = get_device(&addr->bdaddr, addr->type);
 		if (!dev)
 			return;
 	} else {
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] android/bluetooth: Fix handling paring related events
  2014-09-02 11:51 [PATCH v2] android/bluetooth: Fix handling paring related events Lukasz Rymanowski
@ 2014-09-02 15:43 ` Szymon Janc
  0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-09-02 15:43 UTC (permalink / raw)
  To: Lukasz Rymanowski; +Cc: linux-bluetooth

Hi Łukasz,

On Tuesday 02 of September 2014 13:51:36 Lukasz Rymanowski wrote:
> As it turns out it is possible that kernel send to user space mgmt
> events related to pairing before device connected event.
> In such case BfA was dropping such event because he does not know
> device.
> 
> With this patch, if device is not in the cache, BfA will create it.
> 
> Issue triggered by test: "Bluetooth Accept Bond - Just Works - Success"
> ---
> v2: build error.
>  android/bluetooth.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 99e2aab..bd1e747 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -1240,7 +1240,7 @@ static void new_link_key_callback(uint16_t index, uint16_t length,
>  		return;
>  	}
>  
> -	dev = find_device(&ev->key.addr.bdaddr);
> +	dev = get_device(&ev->key.addr.bdaddr, ev->key.addr.type);
>  	if (!dev)
>  		return;
>  
> @@ -1335,7 +1335,7 @@ static void user_confirm_request_callback(uint16_t index, uint16_t length,
>  	ba2str(&ev->addr.bdaddr, dst);
>  	DBG("%s confirm_hint %u", dst, ev->confirm_hint);
>  
> -	dev = find_device(&ev->addr.bdaddr);
> +	dev = get_device(&ev->addr.bdaddr, ev->addr.type);
>  	if (!dev)
>  		return;
>  
> @@ -1363,7 +1363,7 @@ static void user_passkey_request_callback(uint16_t index, uint16_t length,
>  	ba2str(&ev->addr.bdaddr, dst);
>  	DBG("%s", dst);
>  
> -	dev = find_device(&ev->addr.bdaddr);
> +	dev = get_device(&ev->addr.bdaddr, ev->addr.type);
>  	if (!dev)
>  		return;
>  
> @@ -2288,7 +2288,7 @@ static void new_csrk_callback(uint16_t index, uint16_t length,
>  	}
>  
>  	ba2str(&ev->key.addr.bdaddr, dst);
> -	dev = find_device(&ev->key.addr.bdaddr);
> +	dev = get_device(&ev->key.addr.bdaddr, ev->key.addr.type);
>  	if (!dev)
>  		return;
>  
> @@ -2363,7 +2363,7 @@ static void new_irk_callback(uint16_t index, uint16_t length,
>  	DBG("new IRK for %s, RPA %s", dst, rpa);
>  
>  	if (!bacmp(&ev->rpa, BDADDR_ANY)) {
> -		dev = find_device(&addr->bdaddr);
> +		dev = get_device(&addr->bdaddr, addr->type);
>  		if (!dev)
>  			return;
>  	} else {
> 

Applied, thanks.

-- 
Best regards, 
Szymon Janc

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-02 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-02 11:51 [PATCH v2] android/bluetooth: Fix handling paring related events Lukasz Rymanowski
2014-09-02 15:43 ` Szymon Janc

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.