]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Bluetooth: Fix checking for HCI_SETUP flag when receiving mgmt commands
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 10 Oct 2013 16:06:04 +0000 (18:06 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 10 Oct 2013 16:13:45 +0000 (09:13 -0700)
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 <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c

index e7ffd39100a0574b6a797d261206494a3ccfb438..7d25d6dcd79d5ee005a3357165387d3ef3adab76 100644 (file)
@@ -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;