Bluetooth: Fix checking for HCI_SETUP flag when receiving mgmt commands
Subsystems (2)
PATCH 1/1 Bluetooth: Fix checking for HCI_SETUP flag when receiving mgmt commands
From: Johan Hedberg <[email protected]>
When the HCI_SETUP flag is set the controller has not yet been announced over mgmt and therefore doesn't exist from that perspective. If we nevertheless get a mgmt command for it we should respond with the appropriate INVALID_INDEX error.
Signed-off-by Johan Hedberg <[email protected]>
--- net/bluetooth/mgmt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/mgmt.c +2 -1
@@ -3753,7 +3753,8 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen) goto done; } -if (test_bit (HCI_USER_CHANNEL , &hdev->dev_flags)) { +if (test_bit (HCI_SETUP , &hdev->dev_flags) || +test_bit (HCI_USER_CHANNEL , &hdev->dev_flags)) { err =cmd_status (sk, index, opcode,MGMT_STATUS_INVALID_INDEX ); goto done;
Signature · 1 line
1.8.3.1
Marcel Holtmann
maintainerHi Johan,
Quoted 9 lines
When the
HCI_SETUPflag is set the controller has not yet been announced over mgmt and therefore doesn't exist from that perspective. If we nevertheless get a mgmt command for it we should respond with the appropriateINVALID_INDEXerror.Signed-off-by Johan Hedberg <[email protected]>---
net/bluetooth/mgmt.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel