From: Aditya Pakki Date: Sun, 14 Jun 2020 03:15:25 +0000 (-0500) Subject: usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work X-Git-Tag: v5.8-rc3~17^2^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2655971ad4b34e97dd921df16bb0b08db9449df7;p=thirdparty%2Fkernel%2Flinux.git usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work dwc3_pci_resume_work() calls pm_runtime_get_sync() that increments the reference counter. In case of failure, decrement the reference before returning. Signed-off-by: Aditya Pakki Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index b67372737dc9b..96c05b121fac8 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -206,8 +206,10 @@ static void dwc3_pci_resume_work(struct work_struct *work) int ret; ret = pm_runtime_get_sync(&dwc3->dev); - if (ret) + if (ret) { + pm_runtime_put_sync_autosuspend(&dwc3->dev); return; + } pm_runtime_mark_last_busy(&dwc3->dev); pm_runtime_put_sync_autosuspend(&dwc3->dev);