diff mbox series

Bluetooth: mgmt: add mgmt_cmd_status in add_advertising

Message ID 20200310093101.1.Iaa45f22c4b2bb1828e88211b2d28c24d6ddd50a7@changeid
State Awaiting Upstream
Delegated to: David Miller
Headers show
Series Bluetooth: mgmt: add mgmt_cmd_status in add_advertising | expand

Commit Message

Manish Mandlik March 10, 2020, 4:31 p.m. UTC
From: Joseph Hwang <josephsih@chromium.org>

From: Joseph Hwang <josephsih@chromium.org>

If an error occurs during request building in add_advertising(),
remember to send MGMT_STATUS_FAILED command status back to bluetoothd.

Signed-off-by: Joseph Hwang <josephsih@chromium.org>
Signed-off-by: Manish Mandlik <mmandlik@google.com>
---

 net/bluetooth/mgmt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Marcel Holtmann March 11, 2020, 2:35 p.m. UTC | #1
Hi Manish,

> If an error occurs during request building in add_advertising(),
> remember to send MGMT_STATUS_FAILED command status back to bluetoothd.
> 
> Signed-off-by: Joseph Hwang <josephsih@chromium.org>
> Signed-off-by: Manish Mandlik <mmandlik@google.com>
> ---
> 
> net/bluetooth/mgmt.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 1002c657768a0..2398f57b7dc3c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -6747,8 +6747,11 @@  static int add_advertising(struct sock *sk, struct hci_dev *hdev,
 	if (!err)
 		err = hci_req_run(&req, add_advertising_complete);
 
-	if (err < 0)
+	if (err < 0) {
+		err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_ADVERTISING,
+				      MGMT_STATUS_FAILED);
 		mgmt_pending_remove(cmd);
+	}
 
 unlock:
 	hci_dev_unlock(hdev);