linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: core: fix reference count leak in usb_port_resume
@ 2020-06-14  3:33 Aditya Pakki
  2020-06-14 13:42 ` Alan Stern
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2020-06-14  3:33 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, wu000273, Greg Kroah-Hartman, Alan Stern, Eugeniu Rosca,
	Andrew Morton, Mathias Nyman, Kai-Heng Feng, Lee, Chiasheng,
	David Heinzelmann, Hardik Gajjar, linux-usb, linux-kernel

usb_port_resume() calls pm_runtime_get_sync() that increments
the reference counter. In case of failure, decrement the reference
count and return the error.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/usb/core/hub.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index b1e14beaac5f..a9231f27144e 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3542,6 +3542,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
 		if (status < 0) {
 			dev_dbg(&udev->dev, "can't resume usb port, status %d\n",
 					status);
+			pm_runtime_put_sync(&port_dev->dev);
 			return status;
 		}
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-14 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14  3:33 [PATCH] usb: core: fix reference count leak in usb_port_resume Aditya Pakki
2020-06-14 13:42 ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).