Skip to content

Commit

Permalink
Input: gtco - fix usb_dev leak
Browse files Browse the repository at this point in the history
There is usb_get_dev() in gtco_probe(), but there is no usb_put_dev()
anywhere in the driver.

As pointed out by Dmitry Torokhov:
The lifetime of gtco structure is already directly tied to lifetime of
usb_dev: when destroying usb_dev driver core will call remove() function
of currently bound driver (in our case gtco) which will destroy gtco
memory. Taking additional reference is not needed here.

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

Signed-off-by: Alexey Khoroshilov <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
  • Loading branch information
khoroshilov authored and dtor committed Jan 28, 2014
1 parent 11601a8 commit 1f906f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/input/tablet/gtco.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
gtco->inputdevice = input_dev;

/* Save interface information */
gtco->usbdev = usb_get_dev(interface_to_usbdev(usbinterface));
gtco->usbdev = interface_to_usbdev(usbinterface);
gtco->intf = usbinterface;

/* Allocate some data for incoming reports */
Expand Down

0 comments on commit 1f906f8

Please sign in to comment.