From: Jens Axboe <axboe@kernel.dk>
To: Tejun Heo <tj@kernel.org>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, linux-block@vger.kernel.org
Subject: Re: [PATCH block/for-linus] blkcg: Fix multiple bugs in blkcg_activate_policy()
Date: Tue, 15 Oct 2019 10:13:38 -0600 [thread overview]
Message-ID: <8406cdae-fa26-3db5-f97d-347059cdbc16@kernel.dk> (raw)
In-Reply-To: <20191015160347.GM18794@devbig004.ftw2.facebook.com>
On 10/15/19 10:03 AM, Tejun Heo wrote:
> blkcg_activate_policy() has the following bugs.
>
> * cf09a8ee19ad ("blkcg: pass @q and @blkcg into
> blkcg_pol_alloc_pd_fn()") added @blkcg to ->pd_alloc_fn(); however,
> blkcg_activate_policy() ends up using pd's allocated for the root
> blkcg for all preallocations, so ->pd_init_fn() for non-root blkcgs
> can be passed in pd's which are allocated for the root blkcg.
>
> For blk-iocost, this means that ->pd_init_fn() can write beyond the
> end of the allocated object as it determines the length of the flex
> array at the end based on the blkcg's nesting level.
>
> * Each pd is initialized as they get allocated. If alloc fails, the
> policy will get freed with pd's initialized on it.
>
> * After the above partial failure, the partial pds are not freed.
>
> This patch fixes all the above issues by
>
> * Restructuring blkcg_activate_policy() so that alloc and init passes
> are separate. Init takes place only after all allocs succeeded and
> on failure all allocated pds are freed.
>
> * Unifying and fixing the cleanup of the remaining pd_prealloc.
Great thanks, applied.
--
Jens Axboe
prev parent reply other threads:[~2019-10-15 16:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <alpine.DEB.2.21.1910151232480.2818@hadrien>
2019-10-15 15:48 ` [PATCH block/for-linus] blkcg: fix botched pd_prealloc error handling in blkcg_activate_policy() Tejun Heo
2019-10-15 15:52 ` Jens Axboe
2019-10-15 16:03 ` [PATCH block/for-linus] blkcg: Fix multiple bugs " Tejun Heo
2019-10-15 16:13 ` Jens Axboe [this message]
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=8406cdae-fa26-3db5-f97d-347059cdbc16@kernel.dk \
--to=axboe@kernel.dk \
--cc=julia.lawall@lip6.fr \
--cc=kbuild-all@lists.01.org \
--cc=kernel-team@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).