Commit 60ed782e authored by Oliver Neukum's avatar Oliver Neukum Committed by Khalid Elmously

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

BugLink: https://bugs.launchpad.net/bugs/1859640

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: default avatarOliver Neukum <oneukum@suse.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 6f29f09b
......@@ -1068,7 +1068,7 @@ static int btusb_open(struct hci_dev *hdev)
if (data->setup_on_usb) {
err = data->setup_on_usb(hdev);
if (err < 0)
return err;
goto setup_fail;
}
data->intf->needs_remote_wakeup = 1;
......@@ -1100,6 +1100,7 @@ static int btusb_open(struct hci_dev *hdev)
failed:
clear_bit(BTUSB_INTR_RUNNING, &data->flags);
setup_fail:
usb_autopm_put_interface(data->intf);
return err;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment