提交 b1a19eeb 编写于 作者: O Oliver Neukum 提交者: Yang Yingliang

Bluetooth: btusb: fix PM leak in error case of setup

commit 3d44a6fd upstream.

If setup() fails a reference for runtime PM has already
been taken. Proper use of the error handling in btusb_open()is needed.
You cannot just return.

Fixes: ace31982 ("Bluetooth: btusb: Add setup callback for chip init on USB")
Signed-off-by: NOliver Neukum <oneukum@suse.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 92b01812
...@@ -1138,7 +1138,7 @@ static int btusb_open(struct hci_dev *hdev) ...@@ -1138,7 +1138,7 @@ static int btusb_open(struct hci_dev *hdev)
if (data->setup_on_usb) { if (data->setup_on_usb) {
err = data->setup_on_usb(hdev); err = data->setup_on_usb(hdev);
if (err < 0) if (err < 0)
return err; goto setup_fail;
} }
data->intf->needs_remote_wakeup = 1; data->intf->needs_remote_wakeup = 1;
...@@ -1170,6 +1170,7 @@ static int btusb_open(struct hci_dev *hdev) ...@@ -1170,6 +1170,7 @@ static int btusb_open(struct hci_dev *hdev)
failed: failed:
clear_bit(BTUSB_INTR_RUNNING, &data->flags); clear_bit(BTUSB_INTR_RUNNING, &data->flags);
setup_fail:
usb_autopm_put_interface(data->intf); usb_autopm_put_interface(data->intf);
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册