diff mbox series

[v2,1/2] Bluetooth: MGMT: Fix failing to MGMT_OP_ADD_UUID/MGMT_OP_REMOVE_UUID

Message ID 1713563327-19694-2-git-send-email-quic_zijuhu@quicinc.com (mailing list archive)
State Not Applicable
Headers show
Series [v2,1/2] Bluetooth: MGMT: Fix failing to MGMT_OP_ADD_UUID/MGMT_OP_REMOVE_UUID | expand

Checks

Context Check Description
tedd_an/pre-ci_am fail error: patch failed: net/bluetooth/mgmt.c:2623 error: net/bluetooth/mgmt.c: patch does not apply hint: Use 'git am --show-current-patch' to see the failed patch

Commit Message

quic_zijuhu April 19, 2024, 9:48 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

These commands don't require the adapter to be up and running so don't
use hci_cmd_sync_queue which would check that flag, instead use
hci_cmd_sync_submit which would ensure mgmt_class_complete is set
properly regardless if any command was actually run or not.

Link: https://github.com/bluez/bluez/issues/809
Fixes: d883a4669a1d ("Bluetooth: hci_sync: Only allow hci_cmd_sync_queue if running")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/mgmt.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

Comments

quic_zijuhu April 19, 2024, 10:05 p.m. UTC | #1
On 4/20/2024 5:48 AM, Zijun Hu wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> These commands don't require the adapter to be up and running so don't
> use hci_cmd_sync_queue which would check that flag, instead use
> hci_cmd_sync_submit which would ensure mgmt_class_complete is set
> properly regardless if any command was actually run or not.
> 
> Link: https://github.com/bluez/bluez/issues/809
> Fixes: d883a4669a1d ("Bluetooth: hci_sync: Only allow hci_cmd_sync_queue if running")
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
>  net/bluetooth/mgmt.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 7129e70a0253..68deec968405 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -2623,7 +2623,11 @@ static int add_uuid(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
>  		goto failed;
>  	}
>  
> -	err = hci_cmd_sync_queue(hdev, add_uuid_sync, cmd, mgmt_class_complete);
> +	/* MGMT_OP_ADD_UUID don't require adapter the UP/Running so use
> +	 * hci_cmd_sync_submit instead of hci_cmd_sync_queue.
> +	 */
> +	err = hci_cmd_sync_submit(hdev, add_uuid_sync, cmd,
> +				  mgmt_class_complete);
>  	if (err < 0) {
>  		mgmt_pending_free(cmd);
>  		goto failed;
> @@ -2717,8 +2721,11 @@ static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data,
>  		goto unlock;
>  	}
>  
> -	err = hci_cmd_sync_queue(hdev, remove_uuid_sync, cmd,
> -				 mgmt_class_complete);
> +	/* MGMT_OP_REMOVE_UUID don't require adapter the UP/Running so use
> +	 * hci_cmd_sync_submit instead of hci_cmd_sync_queue.
> +	 */
> +	err = hci_cmd_sync_submit(hdev, remove_uuid_sync, cmd,
> +				  mgmt_class_complete);
>  	if (err < 0)
>  		mgmt_pending_free(cmd);
>  
> @@ -2784,8 +2791,11 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
>  		goto unlock;
>  	}
>  
> -	err = hci_cmd_sync_queue(hdev, set_class_sync, cmd,
> -				 mgmt_class_complete);
> +	/* MGMT_OP_SET_DEV_CLASS don't require adapter the UP/Running so use
> +	 * hci_cmd_sync_submit instead of hci_cmd_sync_queue.
> +	 */
> +	err = hci_cmd_sync_submit(hdev, set_class_sync, cmd,
> +				  mgmt_class_complete);
>  	if (err < 0)
>  		mgmt_pending_free(cmd);
>  

sorry to send wrong patch sets please ignore it.
bluez.test.bot@gmail.com April 19, 2024, 10:12 p.m. UTC | #2
This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: patch failed: net/bluetooth/mgmt.c:2623
error: net/bluetooth/mgmt.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch

Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7129e70a0253..68deec968405 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2623,7 +2623,11 @@  static int add_uuid(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
 		goto failed;
 	}
 
-	err = hci_cmd_sync_queue(hdev, add_uuid_sync, cmd, mgmt_class_complete);
+	/* MGMT_OP_ADD_UUID don't require adapter the UP/Running so use
+	 * hci_cmd_sync_submit instead of hci_cmd_sync_queue.
+	 */
+	err = hci_cmd_sync_submit(hdev, add_uuid_sync, cmd,
+				  mgmt_class_complete);
 	if (err < 0) {
 		mgmt_pending_free(cmd);
 		goto failed;
@@ -2717,8 +2721,11 @@  static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data,
 		goto unlock;
 	}
 
-	err = hci_cmd_sync_queue(hdev, remove_uuid_sync, cmd,
-				 mgmt_class_complete);
+	/* MGMT_OP_REMOVE_UUID don't require adapter the UP/Running so use
+	 * hci_cmd_sync_submit instead of hci_cmd_sync_queue.
+	 */
+	err = hci_cmd_sync_submit(hdev, remove_uuid_sync, cmd,
+				  mgmt_class_complete);
 	if (err < 0)
 		mgmt_pending_free(cmd);
 
@@ -2784,8 +2791,11 @@  static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
 		goto unlock;
 	}
 
-	err = hci_cmd_sync_queue(hdev, set_class_sync, cmd,
-				 mgmt_class_complete);
+	/* MGMT_OP_SET_DEV_CLASS don't require adapter the UP/Running so use
+	 * hci_cmd_sync_submit instead of hci_cmd_sync_queue.
+	 */
+	err = hci_cmd_sync_submit(hdev, set_class_sync, cmd,
+				  mgmt_class_complete);
 	if (err < 0)
 		mgmt_pending_free(cmd);