OSDN Git Service

Bluetooth: Put HCI device if inquiry procedure interrupts
authorPan Bian <bianpan2016@163.com>
Thu, 21 Jan 2021 08:10:45 +0000 (00:10 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 25 Jan 2021 15:14:58 +0000 (16:14 +0100)
Jump to the label done to decrement the reference count of HCI device
hdev on path that the Inquiry procedure is interrupted.

Fixes: 3e13fa1e1fab ("Bluetooth: Fix hci_inquiry ioctl usage")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_core.c

index b0a63f6..9ea6f3c 100644 (file)
@@ -1362,8 +1362,10 @@ int hci_inquiry(void __user *arg)
                 * cleared). If it is interrupted by a signal, return -EINTR.
                 */
                if (wait_on_bit(&hdev->flags, HCI_INQUIRY,
-                               TASK_INTERRUPTIBLE))
-                       return -EINTR;
+                               TASK_INTERRUPTIBLE)) {
+                       err = -EINTR;
+                       goto done;
+               }
        }
 
        /* for unlimited number of responses we will use buffer with