Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

USB: usbip: drop redundant device reference

Driver core holds a reference to the USB device while it is bound to a
driver and there is no need to take additional references unless the
structure is needed after disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260305133851.2952-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
a1678c4e 0888c337

+1 -4
+1 -4
drivers/usb/usbip/stub_dev.c
··· 267 267 if (!sdev) 268 268 return NULL; 269 269 270 - sdev->udev = usb_get_dev(udev); 270 + sdev->udev = udev; 271 271 272 272 /* 273 273 * devid is defined with devnum when this driver is first allocated. ··· 409 409 put_busid_priv(busid_priv); 410 410 411 411 sdev_free: 412 - usb_put_dev(udev); 413 412 stub_device_free(sdev); 414 413 415 414 return rc; ··· 486 487 487 488 /* shutdown the current connection */ 488 489 shutdown_busid(busid_priv); 489 - 490 - usb_put_dev(sdev->udev); 491 490 492 491 /* we already have busid_priv, just lock busid_lock */ 493 492 spin_lock(&busid_priv->busid_lock);