Patch "siox: fix possible memory leak in siox_device_add()" has been added to the 6.0-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

    siox: fix possible memory leak in siox_device_add()

to the 6.0-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:
     siox-fix-possible-memory-leak-in-siox_device_add.patch
and it can be found in the queue-6.0 subdirectory.

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



commit acf348aa80ddb307ccfcca224685be14a81296f6
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Fri Nov 4 10:13:34 2022 +0800

    siox: fix possible memory leak in siox_device_add()
    
    [ Upstream commit 6e63153db50059fb78b8a8447b132664887d24e3 ]
    
    If device_register() returns error in siox_device_add(),
    the name allocated by dev_set_name() need be freed. As
    comment of device_register() says, it should use put_device()
    to give up the reference in the error path. So fix this
    by calling put_device(), then the name can be freed in
    kobject_cleanup(), and sdevice is freed in siox_device_release(),
    set it to null in error path.
    
    Fixes: bbecb07fa0af ("siox: new driver framework for eckelmann SIOX")
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Reviewed-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221104021334.618189-1-yangyingliang@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c
index 7c4f32d76966..561408583b2b 100644
--- a/drivers/siox/siox-core.c
+++ b/drivers/siox/siox-core.c
@@ -839,6 +839,8 @@ static struct siox_device *siox_device_add(struct siox_master *smaster,
 
 err_device_register:
 	/* don't care to make the buffer smaller again */
+	put_device(&sdevice->dev);
+	sdevice = NULL;
 
 err_buf_alloc:
 	siox_master_unlock(smaster);



[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