blk-cgroup: fix a hd_struct leak in blkcg_fill_root_iostats
authorChristoph Hellwig <hch@lst.de>
Sat, 14 Nov 2020 18:12:46 +0000 (19:12 +0100)
committerJens Axboe <axboe@kernel.dk>
Sat, 14 Nov 2020 18:17:34 +0000 (11:17 -0700)
disk_get_part needs to be paired with a disk_put_part.

Cc: stable@vger.kernel.org
Fixes: ef45fe470e1 ("blk-cgroup: show global disk stats in root cgroup io.stat")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup.c

index c68bdf58c9a6e1c0c2f28246f7d69b903cc698ac..54fbe1e80cc41a2ea6891e497a24a6f7205a868b 100644 (file)
@@ -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);
        }
 }