From: Zijun Hu <zijun_hu@icloud.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Tejun Heo <tj@kernel.org>, Josef Bacik <josef@toxicpanda.com>,
Jens Axboe <axboe@kernel.dk>, Boris Burkov <boris@bur.io>,
Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Dave Jiang <dave.jiang@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Dan Williams <dan.j.williams@intel.com>
Cc: Zijun Hu <zijun_hu@icloud.com>,
linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
linux-block@vger.kernel.org, linux-cxl@vger.kernel.org,
Zijun Hu <quic_zijuhu@quicinc.com>,
stable@vger.kernel.org
Subject: [PATCH v3 2/9] blk-cgroup: Fix class @block_class's subsystem refcount leakage
Date: Thu, 12 Dec 2024 21:38:38 +0800 [thread overview]
Message-ID: <20241212-class_fix-v3-2-04e20c4f0971@quicinc.com> (raw)
In-Reply-To: <20241212-class_fix-v3-0-04e20c4f0971@quicinc.com>
From: Zijun Hu <quic_zijuhu@quicinc.com>
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: ef45fe470e1e ("blk-cgroup: show global disk stats in root cgroup io.stat")
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: stable@vger.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
block/blk-cgroup.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index e68c725cf8d975f53703ecf6e6c50594076204c8..fb9858efdfe9443704cb9a239def0e08addf2518 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1138,6 +1138,7 @@ static void blkcg_fill_root_iostats(void)
blkg_iostat_set(&blkg->iostat.cur, &tmp);
u64_stats_update_end_irqrestore(&blkg->iostat.sync, flags);
}
+ class_dev_iter_exit(&iter);
}
static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
--
2.34.1
next prev parent reply other threads:[~2024-12-12 13:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-12 13:38 [PATCH v3 0/9] driver core: class: Fix bug and code improvements for class APIs Zijun Hu
2024-12-12 13:38 ` [PATCH v3 1/9] driver core: class: Fix wild pointer dereferences in API class_dev_iter_next() Zijun Hu
2024-12-16 15:36 ` Jonathan Cameron
2024-12-17 14:09 ` Zijun Hu
2024-12-12 13:38 ` Zijun Hu [this message]
2024-12-17 10:53 ` [PATCH v3 2/9] blk-cgroup: Fix class @block_class's subsystem refcount leakage Michal Koutný
2024-12-12 13:38 ` [PATCH v3 3/9] driver core: bus: Move true expression out of if condition in API bus_find_device() Zijun Hu
2024-12-16 15:14 ` Jonathan Cameron
2024-12-12 13:38 ` [PATCH v3 4/9] driver core: Move true expression out of if condition in API driver_find_device() Zijun Hu
2024-12-16 15:18 ` Jonathan Cameron
2024-12-16 18:01 ` Fan Ni
2024-12-17 14:13 ` Zijun Hu
2024-12-12 13:38 ` [PATCH v3 5/9] driver core: Move true expression out of if condition in API device_find_child() Zijun Hu
2024-12-16 15:19 ` Jonathan Cameron
2024-12-16 18:02 ` Fan Ni
2024-12-12 13:38 ` [PATCH v3 6/9] driver core: Rename declaration parameter name for API device_find_child() cluster Zijun Hu
2024-12-16 15:21 ` Jonathan Cameron
2024-12-16 18:02 ` Fan Ni
2024-12-12 13:38 ` [PATCH v3 7/9] driver core: Correct parameter check for API device_for_each_child_reverse_from() Zijun Hu
2024-12-16 15:23 ` Jonathan Cameron
2024-12-17 14:18 ` Zijun Hu
2024-12-12 13:38 ` [PATCH v3 8/9] driver core: Correct API device_for_each_child_reverse_from() prototype Zijun Hu
2024-12-16 15:30 ` Jonathan Cameron
2024-12-12 13:38 ` [PATCH v3 9/9] driver core: Introduce device_iter_t for device iterating APIs Zijun Hu
2024-12-16 15:33 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241212-class_fix-v3-2-04e20c4f0971@quicinc.com \
--to=zijun_hu@icloud.com \
--cc=alison.schofield@intel.com \
--cc=axboe@kernel.dk \
--cc=boris@bur.io \
--cc=cgroups@vger.kernel.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=gregkh@linuxfoundation.org \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_zijuhu@quicinc.com \
--cc=rafael@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tj@kernel.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox