[PATCH 5.9 244/252] blk-cgroup: fix a hd_struct leak in blkcg_fill_root_iostats

From: Greg Kroah-Hartman
Date: Mon Nov 23 2020 - 08:03:25 EST


From: Christoph Hellwig <hch@xxxxxx>

commit b7131ee0bac5e5df73e4098e77bbddb3a31d06ff upstream.

disk_get_part needs to be paired with a disk_put_part.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: ef45fe470e1 ("blk-cgroup: show global disk stats in root cgroup io.stat")
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
block/blk-cgroup.c | 1 +
1 file changed, 1 insertion(+)

--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -840,6 +840,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);
}
}