public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] char: xillybus: fix a refcount leak in cleanup_dev()
@ 2022-04-06  7:57 Hangyu Hua
  2022-04-06 15:17 ` Eli Billauer
  0 siblings, 1 reply; 2+ messages in thread
From: Hangyu Hua @ 2022-04-06  7:57 UTC (permalink / raw)
  To: eli.billauer, arnd, gregkh; +Cc: linux-kernel, Hangyu Hua

usb_get_dev is called in xillyusb_probe. So it is better to call
usb_put_dev before xdev is released.

Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 drivers/char/xillybus/xillyusb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/xillybus/xillyusb.c b/drivers/char/xillybus/xillyusb.c
index dc3551796e5e..39bcbfd908b4 100644
--- a/drivers/char/xillybus/xillyusb.c
+++ b/drivers/char/xillybus/xillyusb.c
@@ -549,6 +549,7 @@ static void cleanup_dev(struct kref *kref)
 	if (xdev->workq)
 		destroy_workqueue(xdev->workq);
 
+	usb_put_dev(xdev->udev);
 	kfree(xdev->channels); /* Argument may be NULL, and that's fine */
 	kfree(xdev);
 }
-- 
2.25.1


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

end of thread, other threads:[~2022-04-06 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-06  7:57 [PATCH] char: xillybus: fix a refcount leak in cleanup_dev() Hangyu Hua
2022-04-06 15:17 ` Eli Billauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox