Patch "driver core: bus: Fix double free in driver API bus_register()" has been added to the 6.6-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

    driver core: bus: Fix double free in driver API bus_register()

to the 6.6-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:
     driver-core-bus-fix-double-free-in-driver-api-bus_re.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 3a1173c139610ca077f21d0786b649ee69a16e98
Author: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
Date:   Sat Jul 27 16:34:01 2024 +0800

    driver core: bus: Fix double free in driver API bus_register()
    
    [ Upstream commit bfa54a793ba77ef696755b66f3ac4ed00c7d1248 ]
    
    For bus_register(), any error which happens after kset_register() will
    cause that @priv are freed twice, fixed by setting @priv with NULL after
    the first free.
    
    Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240727-bus_register_fix-v1-1-fed8dd0dba7a@xxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index d7c4330786cae..e7761e0ef5a55 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -920,6 +920,8 @@ int bus_register(const struct bus_type *bus)
 	bus_remove_file(bus, &bus_attr_uevent);
 bus_uevent_fail:
 	kset_unregister(&priv->subsys);
+	/* Above kset_unregister() will kfree @priv */
+	priv = NULL;
 out:
 	kfree(priv);
 	return retval;




[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