From: "Busch, Keith" <keith.busch@intel.com>
To: Sasha Levin <sasha.levin@oracle.com>,
"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] blk-mq: use after free when freeing tag sets
Date: Fri, 16 Oct 2015 18:00:33 +0000 [thread overview]
Message-ID: <B58D82457FDA0744A320A2FC5AC253B93CD22D1C@fmsmsx104.amr.corp.intel.com> (raw)
In-Reply-To: <56213A4F.6060008@oracle.com>
Oh, the same fix was applied from another developer:
https://git.kernel.org/cgit/linux/kernel/git/axboe/linux-block.git/commit/?h=for-linus&id=f42d79ab67322e51b92dd7aa965e310c71352a64
Yours came first, though I just missed it.
> On 10/02/2015 09:40 PM, Sasha Levin wrote:
> > Commit f26cdc853 ("blk-mq: Shared tag enhancements") has introduced a use after
> > free where it tried to free the cpumask var out of the tag set but the tag set
> > was already freed by blk_mq_free_rq_map().
> >
> > Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> > ---
> > block/blk-mq-tag.c | 1 +
> > block/blk-mq.c | 7 ++-----
> > 2 files changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
> > index f6020c6..c03eeb8 100644
> > --- a/block/blk-mq-tag.c
> > +++ b/block/blk-mq-tag.c
> > @@ -628,6 +628,7 @@ void blk_mq_free_tags(struct blk_mq_tags *tags)
> > {
> > bt_free(&tags->bitmap_tags);
> > bt_free(&tags->breserved_tags);
> > + free_cpumask_var(tags->cpumask);
> > kfree(tags);
> > }
> >
> > diff --git a/block/blk-mq.c b/block/blk-mq.c
> > index 5692c15..197a615 100644
> > --- a/block/blk-mq.c
> > +++ b/block/blk-mq.c
> > @@ -2270,12 +2270,9 @@ void blk_mq_free_tag_set(struct blk_mq_tag_set *set)
> > {
> > int i;
> >
> > - for (i = 0; i < set->nr_hw_queues; i++) {
> > - if (set->tags[i]) {
> > + for (i = 0; i < set->nr_hw_queues; i++)
> > + if (set->tags[i])
> > blk_mq_free_rq_map(set, set->tags[i], i);
> > - free_cpumask_var(set->tags[i]->cpumask);
> > - }
> > - }
> >
> > kfree(set->tags);
> > set->tags = NULL;
> >
prev parent reply other threads:[~2015-10-16 18:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-03 1:40 Sasha Levin
2015-10-16 17:56 ` Sasha Levin
2015-10-16 18:00 ` Busch, Keith [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=B58D82457FDA0744A320A2FC5AC253B93CD22D1C@fmsmsx104.amr.corp.intel.com \
--to=keith.busch@intel.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=sasha.levin@oracle.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
all inboxes | Powered by JetHome®