diff mbox series

Bluetooth: Put HCI device if inquiry procedure interrupts

Message ID 20210121081045.38121-1-bianpan2016@163.com
State Accepted
Commit 28a758c861ff290e39d4f1ee0aa5df0f0b9a45ee
Headers show
Series Bluetooth: Put HCI device if inquiry procedure interrupts | expand

Commit Message

Pan Bian Jan. 21, 2021, 8:10 a.m. UTC
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>
---
 net/bluetooth/hci_core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Marcel Holtmann Jan. 25, 2021, 3:15 p.m. UTC | #1
Hi Pan,

> 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>

> ---

> net/bluetooth/hci_core.c | 6 ++++--

> 1 file changed, 4 insertions(+), 2 deletions(-)


patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9d2c9a1c552f..9f8573131b97 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -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