* [PATCH] btusb: fix PM leak in error case of setup
@ 2019-11-14 15:01 Oliver Neukum
2019-11-15 8:07 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2019-11-14 15:01 UTC (permalink / raw)
To: ytkim, marcel, johan.hedberg, linux-bluetooth; +Cc: Oliver Neukum
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: ace31982585a3 ("Bluetooth: btusb: Add setup callback for chip
init on USB")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/bluetooth/btusb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index a9c35ebb30f8..0b5e4c135f78 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1200,7 +1200,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;
@@ -1239,6 +1239,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;
}
--
2.16.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] btusb: fix PM leak in error case of setup
2019-11-14 15:01 [PATCH] btusb: fix PM leak in error case of setup Oliver Neukum
@ 2019-11-15 8:07 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2019-11-15 8:07 UTC (permalink / raw)
To: Oliver Neukum; +Cc: ytkim, Johan Hedberg, linux-bluetooth
Hi Oliver,
> 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: ace31982585a3 ("Bluetooth: btusb: Add setup callback for chip
> init on USB")
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> ---
> drivers/bluetooth/btusb.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-15 8:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-14 15:01 [PATCH] btusb: fix PM leak in error case of setup Oliver Neukum
2019-11-15 8:07 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox