From: <gregkh@linuxfoundation.org>
To: j-nomura@ce.jp.nec.com, axboe@fb.com, gregkh@linuxfoundation.org,
jmoyer@redhat.com, keith.busch@intel.com
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "blk-mq: fix use-after-free in blk_mq_free_tag_set()" has been added to the 4.2-stable tree
Date: Thu, 05 Nov 2015 22:58:43 -0800 [thread overview]
Message-ID: <1446793123164161@kroah.com> (raw)
This is a note to let you know that I've just added the patch titled
blk-mq: fix use-after-free in blk_mq_free_tag_set()
to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
blk-mq-fix-use-after-free-in-blk_mq_free_tag_set.patch
and it can be found in the queue-4.2 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From f42d79ab67322e51b92dd7aa965e310c71352a64 Mon Sep 17 00:00:00 2001
From: Junichi Nomura <j-nomura@ce.jp.nec.com>
Date: Wed, 14 Oct 2015 05:02:15 +0000
Subject: blk-mq: fix use-after-free in blk_mq_free_tag_set()
From: Junichi Nomura <j-nomura@ce.jp.nec.com>
commit f42d79ab67322e51b92dd7aa965e310c71352a64 upstream.
tags is freed in blk_mq_free_rq_map() and should not be used after that.
The problem doesn't manifest if CONFIG_CPUMASK_OFFSTACK is false because
free_cpumask_var() is nop.
tags->cpumask is allocated in blk_mq_init_tags() so it's natural to
free cpumask in its counter part, blk_mq_free_tags().
Fixes: f26cdc8536ad ("blk-mq: Shared tag enhancements")
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: Keith Busch <keith.busch@intel.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
block/blk-mq-tag.c | 1 +
block/blk-mq.c | 4 +---
2 files changed, 2 insertions(+), 3 deletions(-)
--- 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
{
bt_free(&tags->bitmap_tags);
bt_free(&tags->breserved_tags);
+ free_cpumask_var(tags->cpumask);
kfree(tags);
}
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2263,10 +2263,8 @@ void blk_mq_free_tag_set(struct blk_mq_t
int i;
for (i = 0; i < set->nr_hw_queues; i++) {
- if (set->tags[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);
Patches currently in stable-queue which might be from j-nomura@ce.jp.nec.com are
queue-4.2/blk-mq-fix-use-after-free-in-blk_mq_free_tag_set.patch
reply other threads:[~2015-11-06 6:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1446793123164161@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=axboe@fb.com \
--cc=j-nomura@ce.jp.nec.com \
--cc=jmoyer@redhat.com \
--cc=keith.busch@intel.com \
--cc=stable-commits@vger.kernel.org \
--cc=stable@vger.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).