Re: [linux-yocto] [PATCH] Bluetooth: Delay check for conn->smp in smp_conn_security()

2015-09-17 Thread Zheng, Wu
Hi Bruce Ashfield,

Thanks.

Best regards
Zheng Wu

-Original Message-
From: Bruce Ashfield [mailto:bruce.ashfi...@windriver.com] 
Sent: Thursday, September 17, 2015 4:22 AM
To: Zheng, Wu; linux-yocto@yoctoproject.org
Subject: Re: [linux-yocto] [PATCH] Bluetooth: Delay check for conn->smp in 
smp_conn_security()

On 15-09-15 05:10 AM, Wu Zheng wrote:
> From: Johan Hedberg <johan.hedb...@intel.com>
>
> There are several actions that smp_conn_security() might make that do 
> not require a valid SMP context (conn->smp pointer). One of these 
> actions is to encrypt the link with an existing LTK. If the SMP 
> context wasn't initialized properly we should still allow the 
> independent actions to be done, i.e. the check for the context should 
> only be done at the last possible moment.

I've staged the commit. When my build tests pass, I'll push it to the servers. 
Should be out by tomorrow.

Bruce

>
> Reported-by: Chuck Ebbert <cebbert.l...@gmail.com>
> Signed-off-by: Johan Hedberg <johan.hedb...@intel.com>
> Signed-off-by: Marcel Holtmann <mar...@holtmann.org>
> ---
>   net/bluetooth/smp.c | 12 ++--
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 
> ad82324..0510a57 100644
> --- a/net/bluetooth/smp.c
> +++ b/net/bluetooth/smp.c
> @@ -2311,12 +2311,6 @@ int smp_conn_security(struct hci_conn *hcon, __u8 
> sec_level)
>   if (!conn)
>   return 1;
>
> - chan = conn->smp;
> - if (!chan) {
> - BT_ERR("SMP security requested but not available");
> - return 1;
> - }
> -
>   if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED))
>   return 1;
>
> @@ -2330,6 +2324,12 @@ int smp_conn_security(struct hci_conn *hcon, __u8 
> sec_level)
>   if (smp_ltk_encrypt(conn, hcon->pending_sec_level))
>   return 0;
>
> + chan = conn->smp;
> + if (!chan) {
> + BT_ERR("SMP security requested but not available");
> + return 1;
> + }
> +
>   l2cap_chan_lock(chan);
>
>   /* If SMP is already in progress ignore this request */
>

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


Re: [linux-yocto] [PATCH] Bluetooth: Delay check for conn->smp in smp_conn_security()

2015-09-16 Thread Bruce Ashfield

On 15-09-15 05:10 AM, Wu Zheng wrote:

From: Johan Hedberg 

There are several actions that smp_conn_security() might make that do
not require a valid SMP context (conn->smp pointer). One of these
actions is to encrypt the link with an existing LTK. If the SMP
context wasn't initialized properly we should still allow the
independent actions to be done, i.e. the check for the context should
only be done at the last possible moment.


I've staged the commit. When my build tests pass, I'll push it to
the servers. Should be out by tomorrow.

Bruce



Reported-by: Chuck Ebbert 
Signed-off-by: Johan Hedberg 
Signed-off-by: Marcel Holtmann 
---
  net/bluetooth/smp.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index ad82324..0510a57 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -2311,12 +2311,6 @@ int smp_conn_security(struct hci_conn *hcon, __u8 
sec_level)
if (!conn)
return 1;

-   chan = conn->smp;
-   if (!chan) {
-   BT_ERR("SMP security requested but not available");
-   return 1;
-   }
-
if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED))
return 1;

@@ -2330,6 +2324,12 @@ int smp_conn_security(struct hci_conn *hcon, __u8 
sec_level)
if (smp_ltk_encrypt(conn, hcon->pending_sec_level))
return 0;

+   chan = conn->smp;
+   if (!chan) {
+   BT_ERR("SMP security requested but not available");
+   return 1;
+   }
+
l2cap_chan_lock(chan);

/* If SMP is already in progress ignore this request */



--
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [PATCH] Bluetooth: Delay check for conn->smp in smp_conn_security()

2015-09-15 Thread Wu Zheng
From: Johan Hedberg 

There are several actions that smp_conn_security() might make that do
not require a valid SMP context (conn->smp pointer). One of these
actions is to encrypt the link with an existing LTK. If the SMP
context wasn't initialized properly we should still allow the
independent actions to be done, i.e. the check for the context should
only be done at the last possible moment.

Reported-by: Chuck Ebbert 
Signed-off-by: Johan Hedberg 
Signed-off-by: Marcel Holtmann 
---
 net/bluetooth/smp.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index ad82324..0510a57 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -2311,12 +2311,6 @@ int smp_conn_security(struct hci_conn *hcon, __u8 
sec_level)
if (!conn)
return 1;
 
-   chan = conn->smp;
-   if (!chan) {
-   BT_ERR("SMP security requested but not available");
-   return 1;
-   }
-
if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED))
return 1;
 
@@ -2330,6 +2324,12 @@ int smp_conn_security(struct hci_conn *hcon, __u8 
sec_level)
if (smp_ltk_encrypt(conn, hcon->pending_sec_level))
return 0;
 
+   chan = conn->smp;
+   if (!chan) {
+   BT_ERR("SMP security requested but not available");
+   return 1;
+   }
+
l2cap_chan_lock(chan);
 
/* If SMP is already in progress ignore this request */
-- 
2.1.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [PATCH] Bluetooth: Delay check for conn->smp in smp_conn_security()

2015-09-11 Thread wu . zheng
From: Wu Zheng 

There are several actions that smp_conn_security() might make that do
not require a valid SMP context (conn->smp pointer). One of these
actions is to encrypt the link with an existing LTK. If the SMP
context wasn't initialized properly we should still allow the
independent actions to be done, i.e. the check for the context should
only be done at the last possible moment.

Reported-by: Chuck Ebbert 
Signed-off-by: Johan Hedberg 
Signed-off-by: Marcel Holtmann 
---
At the same time, the patch fixes the error warning issues of 6lowpan
over Bluetooth LE connection failed between two Bluetooth LE devices.

The patch was imported from the bluetooth git server
(http://git.kernel.org/cgit/linux/kernel/git/bluetooth/bluetooth-next.git)
as of commit id 0dd5c7aa199b25a88e9fa72824abaf0020ec8066.
---
 net/bluetooth/smp.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 7b815bc..69ad509 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -2294,12 +2294,6 @@ int smp_conn_security(struct hci_conn *hcon, __u8 
sec_level)
if (!conn)
return 1;
 
-   chan = conn->smp;
-   if (!chan) {
-   BT_ERR("SMP security requested but not available");
-   return 1;
-   }
-
if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED))
return 1;
 
@@ -2313,6 +2307,12 @@ int smp_conn_security(struct hci_conn *hcon, __u8 
sec_level)
if (smp_ltk_encrypt(conn, hcon->pending_sec_level))
return 0;
 
+   chan = conn->smp;
+   if (!chan) {
+   BT_ERR("SMP security requested but not available");
+   return 1;
+   }
+
l2cap_chan_lock(chan);
 
/* If SMP is already in progress ignore this request */
-- 
2.1.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [PATCH] Bluetooth: Delay check for conn->smp in smp_conn_security()

2015-09-11 Thread Wu Zheng
There are several actions that smp_conn_security() might make that do
not require a valid SMP context (conn->smp pointer). One of these
actions is to encrypt the link with an existing LTK. If the SMP
context wasn't initialized properly we should still allow the
independent actions to be done, i.e. the check for the context should
only be done at the last possible moment.

Reported-by: Chuck Ebbert 
Signed-off-by: Johan Hedberg 
Signed-off-by: Marcel Holtmann 
---
At the same time, the patch fixes the error warning issues of 6lowpan
over Bluetooth LE connection failed between two Bluetooth LE devices.

The patch was imported from the bluetooth git server
(http://git.kernel.org/cgit/linux/kernel/git/bluetooth/bluetooth-next.git)
as of commit id 0dd5c7aa199b25a88e9fa72824abaf0020ec8066.
---
 net/bluetooth/smp.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 7b815bc..69ad509 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -2294,12 +2294,6 @@ int smp_conn_security(struct hci_conn *hcon, __u8 
sec_level)
if (!conn)
return 1;
 
-   chan = conn->smp;
-   if (!chan) {
-   BT_ERR("SMP security requested but not available");
-   return 1;
-   }
-
if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED))
return 1;
 
@@ -2313,6 +2307,12 @@ int smp_conn_security(struct hci_conn *hcon, __u8 
sec_level)
if (smp_ltk_encrypt(conn, hcon->pending_sec_level))
return 0;
 
+   chan = conn->smp;
+   if (!chan) {
+   BT_ERR("SMP security requested but not available");
+   return 1;
+   }
+
l2cap_chan_lock(chan);
 
/* If SMP is already in progress ignore this request */
-- 
2.1.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto