Patch "extcon: Fix error handling in extcon_dev_register" has been added to the 5.11-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

    extcon: Fix error handling in extcon_dev_register

to the 5.11-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:
     extcon-fix-error-handling-in-extcon_dev_register.patch
and it can be found in the queue-5.11 subdirectory.

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



commit 41cf224b7f9b147a85643f91abd804707ef4b218
Author: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
Date:   Tue Jan 19 16:10:55 2021 +0800

    extcon: Fix error handling in extcon_dev_register
    
    [ Upstream commit d3bdd1c3140724967ca4136755538fa7c05c2b4e ]
    
    When devm_kcalloc() fails, we should execute device_unregister()
    to unregister edev->dev from system.
    
    Fixes: 046050f6e623e ("extcon: Update the prototype of extcon_register_notifier() with enum extcon")
    Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
    Signed-off-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 0a6438cbb3f3..e7a9561a826d 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -1241,6 +1241,7 @@ int extcon_dev_register(struct extcon_dev *edev)
 				sizeof(*edev->nh), GFP_KERNEL);
 	if (!edev->nh) {
 		ret = -ENOMEM;
+		device_unregister(&edev->dev);
 		goto err_dev;
 	}
 



[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