char: xillybus: fix a refcount leak in cleanup_dev()
authorHangyu Hua <hbh25y@gmail.com>
Wed, 6 Apr 2022 07:57:03 +0000 (15:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:36:21 +0000 (18:36 +0200)
[ Upstream commit b67d19662fdee275c479d21853bc1239600a798f ]

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

Acked-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Link: https://lore.kernel.org/r/20220406075703.23464-1-hbh25y@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/char/xillybus/xillyusb.c

index dc35517..39bcbfd 100644 (file)
@@ -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);
 }