Patch "i2c: core: fix reference leak in i2c_register_adapter()" has been added to the 6.12-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

    i2c: core: fix reference leak in i2c_register_adapter()

to the 6.12-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:
     i2c-core-fix-reference-leak-in-i2c_register_adapter.patch
and it can be found in the queue-6.12 subdirectory.

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



commit d7fdea33e0475afe2ceb58c44f8c289259868438
Author: Joe Hattori <joe@xxxxxxxxxxxxxxxxxxxxx>
Date:   Wed Dec 11 12:08:03 2024 +0900

    i2c: core: fix reference leak in i2c_register_adapter()
    
    [ Upstream commit 3f8c4f5e9a57868fa107016c81165686d23325f2 ]
    
    The reference count of the device incremented in device_initialize() is
    not decremented when device_add() fails. Add a put_device() call before
    returning from the function.
    
    This bug was found by an experimental static analysis tool that I am
    developing.
    
    Fixes: 60f68597024d ("i2c: core: Setup i2c_adapter runtime-pm before calling device_add()")
    Signed-off-by: Joe Hattori <joe@xxxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 7c810893bfa33..75d30861ffe21 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1562,6 +1562,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 	res = device_add(&adap->dev);
 	if (res) {
 		pr_err("adapter '%s': can't register device (%d)\n", adap->name, res);
+		put_device(&adap->dev);
 		goto out_list;
 	}
 




[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