Patch "power: supply: fix residue sysfs file in error handle route of __power_supply_register()" has been added to the 5.10-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

    power: supply: fix residue sysfs file in error handle route of __power_supply_register()

to the 5.10-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:
     power-supply-fix-residue-sysfs-file-in-error-handle-.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 35f86d3ccab7ebbe4ab5a65d3d0ffbb2fd46aca4
Author: Zeng Heng <zengheng4@xxxxxxxxxx>
Date:   Thu Nov 17 16:32:19 2022 +0800

    power: supply: fix residue sysfs file in error handle route of __power_supply_register()
    
    [ Upstream commit 5b79480ce1978864ac3f06f2134dfa3b6691fe74 ]
    
    If device_add() succeeds, we should call device_del() when want to
    get rid of it, so move it into proper jump symbol.
    
    Otherwise, when __power_supply_register() returns fail and goto
    wakeup_init_failed to exit, there is still residue device file in sysfs.
    When attempt to probe device again, sysfs would complain as below:
    
    sysfs: cannot create duplicate filename '/devices/platform/i2c/i2c-0/0-001c/power_supply/adp5061'
    Call Trace:
     dump_stack_lvl+0x68/0x85
     sysfs_warn_dup.cold+0x1c/0x29
     sysfs_create_dir_ns+0x1b1/0x1d0
     kobject_add_internal+0x143/0x390
     kobject_add+0x108/0x170
    
    Fixes: 80c6463e2fa3 ("power_supply: Fix Oops from NULL pointer dereference from wakeup_source_activate")
    Signed-off-by: Zeng Heng <zengheng4@xxxxxxxxxx>
    Signed-off-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 280c54c23e37..be2cb925c115 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -1201,8 +1201,8 @@ __power_supply_register(struct device *parent,
 register_cooler_failed:
 	psy_unregister_thermal(psy);
 register_thermal_failed:
-	device_del(dev);
 wakeup_init_failed:
+	device_del(dev);
 device_add_failed:
 check_supplies_failed:
 dev_set_name_failed:



[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