Patch "HID: elo: Revert USB reference counting" has been added to the 5.16-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    HID: elo: Revert USB reference counting

to the 5.16-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hid-elo-revert-usb-reference-counting.patch
and it can be found in the queue-5.16 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit dce1b0f691c8f3b632d88596a29a387e33b1bea4
Author: Jiri Kosina <jkosina@xxxxxxx>
Date:   Thu Feb 17 14:13:49 2022 +0100

    HID: elo: Revert USB reference counting
    
    [ Upstream commit ac89895213d8950dba6ab342863a0959f73142a7 ]
    
    Commit 817b8b9c539 ("HID: elo: fix memory leak in elo_probe") introduced
    memory leak on error path, but more importantly the whole USB reference
    counting is not needed at all in the first place, as the driver itself
    doesn't change the reference counting in any way, and the associated
    usb_device is guaranteed to be kept around by USB core as long as the
    driver binding exists.
    
    Reported-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
    Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Fixes: fbf42729d0e ("HID: elo: update the reference count of the usb device structure")
    Fixes: 817b8b9c539 ("HID: elo: fix memory leak in elo_probe")
    Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hid/hid-elo.c b/drivers/hid/hid-elo.c
index 9b42b0cdeef0..2876cb6a7dca 100644
--- a/drivers/hid/hid-elo.c
+++ b/drivers/hid/hid-elo.c
@@ -228,7 +228,6 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id)
 {
 	struct elo_priv *priv;
 	int ret;
-	struct usb_device *udev;
 
 	if (!hid_is_usb(hdev))
 		return -EINVAL;
@@ -238,8 +237,7 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		return -ENOMEM;
 
 	INIT_DELAYED_WORK(&priv->work, elo_work);
-	udev = interface_to_usbdev(to_usb_interface(hdev->dev.parent));
-	priv->usbdev = usb_get_dev(udev);
+	priv->usbdev = interface_to_usbdev(to_usb_interface(hdev->dev.parent));
 
 	hid_set_drvdata(hdev, priv);
 
@@ -262,7 +260,6 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
 	return 0;
 err_free:
-	usb_put_dev(udev);
 	kfree(priv);
 	return ret;
 }
@@ -271,8 +268,6 @@ static void elo_remove(struct hid_device *hdev)
 {
 	struct elo_priv *priv = hid_get_drvdata(hdev);
 
-	usb_put_dev(priv->usbdev);
-
 	hid_hw_stop(hdev);
 	cancel_delayed_work_sync(&priv->work);
 	kfree(priv);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux