[PATCH 01/45] blk-cgroup: fix a hd_struct leak in blkcg_fill_root_iostats

Christoph Hellwig hch at lst.de
Tue Nov 24 08:27:07 EST 2020


disk_get_part needs to be paired with a disk_put_part.

Fixes: ef45fe470e1 ("blk-cgroup: show global disk stats in root cgroup io.stat")
Signed-off-by: Christoph Hellwig <hch at lst.de>
Reviewed-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Reviewed-by: Jan Kara <jack at suse.cz>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn at wdc.com>
Acked-by: Tejun Heo <tj at kernel.org>
---
 block/blk-cgroup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index c68bdf58c9a6e1..54fbe1e80cc41a 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -849,6 +849,7 @@ static void blkcg_fill_root_iostats(void)
 			blkg_iostat_set(&blkg->iostat.cur, &tmp);
 			u64_stats_update_end(&blkg->iostat.sync);
 		}
+		disk_put_part(part);
 	}
 }
 
-- 
2.29.2




More information about the linux-mtd mailing list