All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: pxrc - fix leak of usb_device
@ 2018-07-13 20:07 Alexey Khoroshilov
  2018-07-14  8:09 ` Marcus Folkesson
  0 siblings, 1 reply; 9+ messages in thread
From: Alexey Khoroshilov @ 2018-07-13 20:07 UTC (permalink / raw)
  To: Dmitry Torokhov, Marcus Folkesson
  Cc: Alexey Khoroshilov, linux-input, linux-kernel, ldv-project

pxrc_probe() calls usb_get_dev(), but there is no usb_put_dev()
anywhere in the driver.

The patch adds one to error handling code and to pxrc_disconnect().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/input/joystick/pxrc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c
index 07a0dbd3ced2..0a31de63ac8e 100644
--- a/drivers/input/joystick/pxrc.c
+++ b/drivers/input/joystick/pxrc.c
@@ -221,6 +221,7 @@ static int pxrc_probe(struct usb_interface *intf,
 	usb_free_urb(pxrc->urb);
 
 error:
+	usb_put_dev(pxrc->udev);
 	return retval;
 }
 
@@ -229,6 +230,7 @@ static void pxrc_disconnect(struct usb_interface *intf)
 	struct pxrc *pxrc = usb_get_intfdata(intf);
 
 	usb_free_urb(pxrc->urb);
+	usb_put_dev(pxrc->udev);
 	usb_set_intfdata(intf, NULL);
 }
 
-- 
2.7.4


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

end of thread, other threads:[~2018-07-15 19:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-13 20:07 [PATCH] Input: pxrc - fix leak of usb_device Alexey Khoroshilov
2018-07-14  8:09 ` Marcus Folkesson
2018-07-14  8:51   ` Dmitry Torokhov
2018-07-15  7:42     ` Marcus Folkesson
2018-07-15  7:42       ` Marcus Folkesson
2018-07-15 10:06       ` Dmitry Torokhov
2018-07-15 10:12         ` Greg Kroah-Hartman
2018-07-15 10:18           ` Dmitry Torokhov
2018-07-15 19:58       ` Alexey Khoroshilov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.