linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: mgmt: Fix wrong param be used
@ 2024-01-25 10:57 clancy_shang
  0 siblings, 0 replies; 8+ messages in thread
From: clancy_shang @ 2024-01-25 10:57 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-bluetooth, linux-kernel, zhongjun.yu, Clancy Shang

From: Clancy Shang <clancy.shang@quectel.com>

if the BlueZ library calls the API interface "adapter_set_device_flags",
which sends the "MGMT_OP_SET_DEVICE_FLAGS" opcode to the kernel, but
does not receive the callback message "MGMT_EV_DEVICE_FLAGS_CHANGED"
from the kernel. it fixs this bug.

Signed-off-by: Clancy Shang <clancy.shang@quectel.com>
---
 net/bluetooth/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9dd815b6603f..c74abdf3618f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -5177,7 +5177,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
 
 done:
 	if (status == MGMT_STATUS_SUCCESS)
-		device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
+		device_flags_changed(NULL, hdev, &cp->addr.bdaddr, cp->addr.type,
 				     supported_flags, current_flags);
 
 	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_FLAGS, status,
-- 
2.25.1


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

* Re: [PATCH] Bluetooth: mgmt: Fix wrong param be used
  2024-02-29  8:40 clancy_shang
@ 2024-02-29 14:14 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2024-02-29 14:14 UTC (permalink / raw)
  To: clancy_shang
  Cc: marcel, johan.hedberg, linux-bluetooth, linux-kernel,
	zhongjun.yu, Clancy Shang

Hi,

On Thu, Feb 29, 2024 at 3:41 AM <clancy_shang@163.com> wrote:
>
> From: Clancy Shang <clancy.shang@quectel.com>
>
> if the BlueZ library calls the API interface "adapter_set_device_flags",
> which sends the "MGMT_OP_SET_DEVICE_FLAGS" opcode to the kernel, but
> does not receive the callback message "MGMT_EV_DEVICE_FLAGS_CHANGED"
> from the kernel. it fixs this bug.

Please stop sending this change, the client who sent
MGMT_OP_SET_DEVICE_FLAGS is not supposed to get
MGMT_EV_DEVICE_FLAGS_CHANGED back:

https://github.com/bluez/bluez/blob/master/doc/mgmt-api.txt#L4975

If there is a problem with that then perhaps it is in userspace not
setting the flag on command complete.

> Signed-off-by: Clancy Shang <clancy.shang@quectel.com>
> ---
>  net/bluetooth/mgmt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 9dd815b6603f..c74abdf3618f 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -5177,7 +5177,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
>
>  done:
>         if (status == MGMT_STATUS_SUCCESS)
> -               device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
> +               device_flags_changed(NULL, hdev, &cp->addr.bdaddr, cp->addr.type,
>                                      supported_flags, current_flags);
>
>         return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_FLAGS, status,
> --
> 2.25.1
>


-- 
Luiz Augusto von Dentz

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

* [PATCH] Bluetooth: mgmt: Fix wrong param be used
@ 2024-02-29  8:40 clancy_shang
  2024-02-29 14:14 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 8+ messages in thread
From: clancy_shang @ 2024-02-29  8:40 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-bluetooth, linux-kernel, zhongjun.yu, Clancy Shang

From: Clancy Shang <clancy.shang@quectel.com>

if the BlueZ library calls the API interface "adapter_set_device_flags",
which sends the "MGMT_OP_SET_DEVICE_FLAGS" opcode to the kernel, but
does not receive the callback message "MGMT_EV_DEVICE_FLAGS_CHANGED"
from the kernel. it fixs this bug.

Signed-off-by: Clancy Shang <clancy.shang@quectel.com>
---
 net/bluetooth/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9dd815b6603f..c74abdf3618f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -5177,7 +5177,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
 
 done:
 	if (status == MGMT_STATUS_SUCCESS)
-		device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
+		device_flags_changed(NULL, hdev, &cp->addr.bdaddr, cp->addr.type,
 				     supported_flags, current_flags);
 
 	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_FLAGS, status,
-- 
2.25.1


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

* [PATCH] Bluetooth: mgmt: Fix wrong param be used
@ 2024-01-18  7:49 clancy_shang
  0 siblings, 0 replies; 8+ messages in thread
From: clancy_shang @ 2024-01-18  7:49 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-bluetooth, linux-kernel, zhongjun.yu, Clancy Shang

From: Clancy Shang <clancy.shang@quectel.com>

if the BlueZ library calls the API interface "adapter_set_device_flags",
which sends the "MGMT_OP_SET_DEVICE_FLAGS" opcode to the kernel, but
does not receive the callback message "MGMT_EV_DEVICE_FLAGS_CHANGED"
from the kernel. it fixs this bug.

Signed-off-by: Clancy Shang <clancy.shang@quectel.com>
---
 net/bluetooth/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9dd815b6603f..c74abdf3618f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -5177,7 +5177,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
 
 done:
 	if (status == MGMT_STATUS_SUCCESS)
-		device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
+		device_flags_changed(NULL, hdev, &cp->addr.bdaddr, cp->addr.type,
 				     supported_flags, current_flags);
 
 	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_FLAGS, status,
-- 
2.25.1


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

* [PATCH] Bluetooth: mgmt: Fix wrong param be used
@ 2024-01-10  7:01 clancy_shang
  0 siblings, 0 replies; 8+ messages in thread
From: clancy_shang @ 2024-01-10  7:01 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-bluetooth, linux-kernel, zhongjun.yu, Clancy Shang

From: Clancy Shang <clancy.shang@quectel.com>

if the BlueZ library calls the API interface "adapter_set_device_flags",
which sends the "MGMT_OP_SET_DEVICE_FLAGS" opcode to the kernel, but
does not receive the callback message "MGMT_EV_DEVICE_FLAGS_CHANGED"
from the kernel. it fixs this bug.

Signed-off-by: Clancy Shang <clancy.shang@quectel.com>
---
 net/bluetooth/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9dd815b6603f..c74abdf3618f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -5177,7 +5177,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
 
 done:
 	if (status == MGMT_STATUS_SUCCESS)
-		device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
+		device_flags_changed(NULL, hdev, &cp->addr.bdaddr, cp->addr.type,
 				     supported_flags, current_flags);
 
 	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_FLAGS, status,
-- 
2.25.1


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

* [PATCH] Bluetooth: mgmt: Fix wrong param be used
@ 2024-01-05  9:52 clancy_shang
  0 siblings, 0 replies; 8+ messages in thread
From: clancy_shang @ 2024-01-05  9:52 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-bluetooth, linux-kernel, zhongjun.yu, Clancy Shang

From: Clancy Shang <clancy.shang@quectel.com>

if the BlueZ library calls the API interface "adapter_set_device_flags",
which sends the "MGMT_OP_SET_DEVICE_FLAGS" opcode to the kernel, but
does not receive the callback message "MGMT_EV_DEVICE_FLAGS_CHANGED"
from the kernel. it fixs this bug.

Signed-off-by: Clancy Shang <clancy.shang@quectel.com>
---
 net/bluetooth/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9dd815b6603f..c74abdf3618f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -5177,7 +5177,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
 
 done:
 	if (status == MGMT_STATUS_SUCCESS)
-		device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
+		device_flags_changed(NULL, hdev, &cp->addr.bdaddr, cp->addr.type,
 				     supported_flags, current_flags);
 
 	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_FLAGS, status,
-- 
2.25.1


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

* Re: [PATCH] Bluetooth: mgmt: Fix wrong param be used
  2024-01-05  3:11 clancy_shang
@ 2024-01-05  8:03 ` Paul Menzel
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Menzel @ 2024-01-05  8:03 UTC (permalink / raw)
  To: Clancy Shang
  Cc: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel,
	zhongjun.yu, Clancy Shang

Dear Clancy,


Thank you for your patch.

Am 05.01.24 um 04:11 schrieb clancy_shang@163.com:
> From: Clancy Shang <clancy.shang@quectel.com>
> 
> bluez lib could not receive MGMT_EV_DEVICE_FLAGS_CHANGED notifications
> after sending MGMT_OP_SET_DEVICE_FLAGS

Please add a dot/period at the end of sentences.

Please extend the commit message to describe your fix, and why it fixes 
the problem.

> Signed-off-by: Clancy Shang <clancy.shang@quectel.com>
> ---
>   net/bluetooth/mgmt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 9dd815b6603f..c74abdf3618f 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -5177,7 +5177,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
>   
>   done:
>   	if (status == MGMT_STATUS_SUCCESS)
> -		device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
> +		device_flags_changed(NULL, hdev, &cp->addr.bdaddr, cp->addr.type,
>   				     supported_flags, current_flags);
>   
>   	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_FLAGS, status,


Kind regards,

Paul

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

* [PATCH] Bluetooth: mgmt: Fix wrong param be used
@ 2024-01-05  3:11 clancy_shang
  2024-01-05  8:03 ` Paul Menzel
  0 siblings, 1 reply; 8+ messages in thread
From: clancy_shang @ 2024-01-05  3:11 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-bluetooth, linux-kernel, zhongjun.yu, Clancy Shang

From: Clancy Shang <clancy.shang@quectel.com>

bluez lib could not receive MGMT_EV_DEVICE_FLAGS_CHANGED notifications
after sending MGMT_OP_SET_DEVICE_FLAGS

Signed-off-by: Clancy Shang <clancy.shang@quectel.com>
---
 net/bluetooth/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9dd815b6603f..c74abdf3618f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -5177,7 +5177,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
 
 done:
 	if (status == MGMT_STATUS_SUCCESS)
-		device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
+		device_flags_changed(NULL, hdev, &cp->addr.bdaddr, cp->addr.type,
 				     supported_flags, current_flags);
 
 	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_FLAGS, status,
-- 
2.25.1


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

end of thread, other threads:[~2024-02-29 14:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 10:57 [PATCH] Bluetooth: mgmt: Fix wrong param be used clancy_shang
  -- strict thread matches above, loose matches on Subject: below --
2024-02-29  8:40 clancy_shang
2024-02-29 14:14 ` Luiz Augusto von Dentz
2024-01-18  7:49 clancy_shang
2024-01-10  7:01 clancy_shang
2024-01-05  9:52 clancy_shang
2024-01-05  3:11 clancy_shang
2024-01-05  8:03 ` Paul Menzel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).