]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
Bluetooth: Put HCI device if inquiry procedure interrupts
authorPan Bian <bianpan2016@163.com>
Thu, 21 Jan 2021 08:10:45 +0000 (00:10 -0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Apr 2021 16:31:22 +0000 (18:31 +0200)
BugLink: https://bugs.launchpad.net/bugs/1918974
[ Upstream commit 28a758c861ff290e39d4f1ee0aa5df0f0b9a45ee ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
net/bluetooth/hci_core.c

index 9e19d5a3aac87086e0e10fc0785eeb64d59512eb..83b324419ad3df0407129709e7a97a89d6c4c858 100644 (file)
@@ -1317,8 +1317,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