Patch "block: fix memory leak in disk_register_independent_access_ranges" has been added to the 5.16-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

    block: fix memory leak in disk_register_independent_access_ranges

to the 5.16-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:
     block-fix-memory-leak-in-disk_register_independent_a.patch
and it can be found in the queue-5.16 subdirectory.

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



commit 6408242ab22060be309736195f5996dc53d4153a
Author: Miaoqian Lin <linmq006@xxxxxxxxx>
Date:   Thu Jan 20 10:10:25 2022 +0000

    block: fix memory leak in disk_register_independent_access_ranges
    
    [ Upstream commit 83114df32ae779df57e0af99a8ba6c3968b2ba3d ]
    
    kobject_init_and_add() takes reference even when it fails.
    According to the doc of kobject_init_and_add()
    
       If this function returns an error, kobject_put() must be called to
       properly clean up the memory associated with the object.
    
    Fix this issue by adding kobject_put().
    Callback function blk_ia_ranges_sysfs_release() in kobject_put()
    can handle the pointer "iars" properly.
    
    Fixes: a2247f19ee1c ("block: Add independent access ranges support")
    Signed-off-by: Miaoqian Lin <linmq006@xxxxxxxxx>
    Reviewed-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220120101025.22411-1-linmq006@xxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/blk-ia-ranges.c b/block/blk-ia-ranges.c
index b925f3db3ab7a..18c68d8b9138e 100644
--- a/block/blk-ia-ranges.c
+++ b/block/blk-ia-ranges.c
@@ -144,7 +144,7 @@ int disk_register_independent_access_ranges(struct gendisk *disk,
 				   &q->kobj, "%s", "independent_access_ranges");
 	if (ret) {
 		q->ia_ranges = NULL;
-		kfree(iars);
+		kobject_put(&iars->kobj);
 		return ret;
 	}
 



[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