Skip to content

Commit d124843

Browse files
zijun-hugregkh
authored andcommitted
blk-cgroup: Fix class @block_class's subsystem refcount leakage
blkcg_fill_root_iostats() iterates over @block_class's devices by class_dev_iter_(init|next)(), but does not end iterating with class_dev_iter_exit(), so causes the class's subsystem refcount leakage. Fix by ending the iterating with class_dev_iter_exit(). Fixes: ef45fe4 ("blk-cgroup: show global disk stats in root cgroup io.stat") Reviewed-by: Michal Koutný <mkoutny@suse.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: stable@vger.kernel.org Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Link: https://lore.kernel.org/r/20250105-class_fix-v6-2-3a2f1768d4d4@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e128f82 commit d124843

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

block/blk-cgroup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,7 @@ static void blkcg_fill_root_iostats(void)
11381138
blkg_iostat_set(&blkg->iostat.cur, &tmp);
11391139
u64_stats_update_end_irqrestore(&blkg->iostat.sync, flags);
11401140
}
1141+
class_dev_iter_exit(&iter);
11411142
}
11421143

11431144
static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)

0 commit comments

Comments
 (0)