Patch "misc: ocxl: fix possible name leak in ocxl_file_register_afu()" has been added to the 5.4-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

    misc: ocxl: fix possible name leak in ocxl_file_register_afu()

to the 5.4-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:
     misc-ocxl-fix-possible-name-leak-in-ocxl_file_regist.patch
and it can be found in the queue-5.4 subdirectory.

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



commit b0f32025d6585c809f5c0855ffa76a82e02136f6
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Fri Nov 11 22:59:29 2022 +0800

    misc: ocxl: fix possible name leak in ocxl_file_register_afu()
    
    [ Upstream commit a4cb1004aeed2ab893a058fad00a5b41a12c4691 ]
    
    If device_register() returns error in ocxl_file_register_afu(),
    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 info is freed in info_release().
    
    Fixes: 75ca758adbaf ("ocxl: Create a clear delineation between ocxl backend & frontend")
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Acked-by: Andrew Donnellan <ajd@xxxxxxxxxxxxx>
    Acked-by: Frederic Barrat <fbarrat@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221111145929.2429271-1-yangyingliang@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
index e094809b54ff..524ded87964d 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -543,8 +543,11 @@ int ocxl_file_register_afu(struct ocxl_afu *afu)
 		goto err_put;
 
 	rc = device_register(&info->dev);
-	if (rc)
-		goto err_put;
+	if (rc) {
+		free_minor(info);
+		put_device(&info->dev);
+		return rc;
+	}
 
 	rc = ocxl_sysfs_register_afu(info);
 	if (rc)



[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