diff mbox series

[4.4] Bluetooth: MGMT: Fix misplaced BT_HS check

Message ID 1643725490-5917-1-git-send-email-guillaume.bertholon@ens.fr
State New
Headers show
Series [4.4] Bluetooth: MGMT: Fix misplaced BT_HS check | expand

Commit Message

Guillaume Bertholon Feb. 1, 2022, 2:24 p.m. UTC
The upstream commit b560a208cda0 ("Bluetooth: MGMT: Fix not checking if
BT_HS is enabled") inserted a new check in the `set_hs` function.
However, its backported version in stable (commit 5abe9f99f512
("Bluetooth: MGMT: Fix not checking if BT_HS is enabled")),
added the check in `set_link_security` instead.

This patch restores the intent of the upstream commit by moving back the
BT_HS check to `set_hs`.

Fixes: 5abe9f99f512 ("Bluetooth: MGMT: Fix not checking if BT_HS is enabled")
Signed-off-by: Guillaume Bertholon <guillaume.bertholon@ens.fr>
---
 net/bluetooth/mgmt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--
2.7.4

Comments

Greg KH Feb. 1, 2022, 4:59 p.m. UTC | #1
On Tue, Feb 01, 2022 at 03:24:50PM +0100, Guillaume Bertholon wrote:
> The upstream commit b560a208cda0 ("Bluetooth: MGMT: Fix not checking if
> BT_HS is enabled") inserted a new check in the `set_hs` function.
> However, its backported version in stable (commit 5abe9f99f512
> ("Bluetooth: MGMT: Fix not checking if BT_HS is enabled")),
> added the check in `set_link_security` instead.
> 
> This patch restores the intent of the upstream commit by moving back the
> BT_HS check to `set_hs`.
> 
> Fixes: 5abe9f99f512 ("Bluetooth: MGMT: Fix not checking if BT_HS is enabled")
> Signed-off-by: Guillaume Bertholon <guillaume.bertholon@ens.fr>
> ---
>  net/bluetooth/mgmt.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 

Now queued up, thanks!

greg k-h
diff mbox series

Patch

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4a95c89..621329c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2285,10 +2285,6 @@  static int set_link_security(struct sock *sk, struct hci_dev *hdev, void *data,

 	BT_DBG("request for %s", hdev->name);

-	if (!IS_ENABLED(CONFIG_BT_HS))
-		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS,
-				       MGMT_STATUS_NOT_SUPPORTED);
-
 	status = mgmt_bredr_support(hdev);
 	if (status)
 		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY,
@@ -2438,6 +2434,10 @@  static int set_hs(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)

 	BT_DBG("request for %s", hdev->name);

+	if (!IS_ENABLED(CONFIG_BT_HS))
+		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS,
+				       MGMT_STATUS_NOT_SUPPORTED);
+
 	status = mgmt_bredr_support(hdev);
 	if (status)
 		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, status);