From: tip-bot for Thomas Gleixner <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: joseph.salisbury@canonical.com, rod.smith@canonical.com,
mingo@kernel.org, eranian@google.com, peterz@infradead.org,
hpa@zytor.com, ak@linux.intel.com, tony.luck@intel.com,
vikas.shivappa@linux.intel.com, ravi.v.shankar@intel.com,
tglx@linutronix.de, linux-kernel@vger.kernel.org,
fenghua.yu@intel.com
Subject: [tip:x86/urgent] x86/intel_rdt/cqm: Prevent use after free
Date: Wed, 17 Jan 2018 03:00:53 -0800 [thread overview]
Message-ID: <tip-d47924417319e3b6a728c0b690f183e75bc2a702@git.kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.20.1801161957510.2366@nanos>
Commit-ID: d47924417319e3b6a728c0b690f183e75bc2a702
Gitweb: https://git.kernel.org/tip/d47924417319e3b6a728c0b690f183e75bc2a702
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 16 Jan 2018 19:59:59 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 17 Jan 2018 11:56:47 +0100
x86/intel_rdt/cqm: Prevent use after free
intel_rdt_iffline_cpu() -> domain_remove_cpu() frees memory first and then
proceeds accessing it.
BUG: KASAN: use-after-free in find_first_bit+0x1f/0x80
Read of size 8 at addr ffff883ff7c1e780 by task cpuhp/31/195
find_first_bit+0x1f/0x80
has_busy_rmid+0x47/0x70
intel_rdt_offline_cpu+0x4b4/0x510
Freed by task 195:
kfree+0x94/0x1a0
intel_rdt_offline_cpu+0x17d/0x510
Do the teardown first and then free memory.
Fixes: 24247aeeabe9 ("x86/intel_rdt/cqm: Improve limbo list processing")
Reported-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Cc: Peter Zilstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Vikas Shivappa <vikas.shivappa@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: "Roderick W. Smith" <rod.smith@canonical.com>
Cc: 1733662@bugs.launchpad.net
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1801161957510.2366@nanos
---
arch/x86/kernel/cpu/intel_rdt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index 88dcf84..9944237 100644
--- a/arch/x86/kernel/cpu/intel_rdt.c
+++ b/arch/x86/kernel/cpu/intel_rdt.c
@@ -525,10 +525,6 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
*/
if (static_branch_unlikely(&rdt_mon_enable_key))
rmdir_mondata_subdir_allrdtgrp(r, d->id);
- kfree(d->ctrl_val);
- kfree(d->rmid_busy_llc);
- kfree(d->mbm_total);
- kfree(d->mbm_local);
list_del(&d->list);
if (is_mbm_enabled())
cancel_delayed_work(&d->mbm_over);
@@ -545,6 +541,10 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
cancel_delayed_work(&d->cqm_limbo);
}
+ kfree(d->ctrl_val);
+ kfree(d->rmid_busy_llc);
+ kfree(d->mbm_total);
+ kfree(d->mbm_local);
kfree(d);
return;
}
next prev parent reply other threads:[~2018-01-17 11:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-12 16:22 [REGRESSION][v4.14.y][v4.15] x86/intel_rdt/cqm: Improve limbo list processing Joseph Salisbury
2018-01-14 11:35 ` Thomas Gleixner
2018-01-16 13:09 ` Thomas Gleixner
[not found] ` <159B72D0-06FE-4925-A11A-1F8A7741BF70@intel.com>
2018-01-16 16:40 ` Joseph Salisbury
2018-01-16 18:09 ` Thomas Gleixner
2018-01-16 18:34 ` Yu, Fenghua
2018-01-16 18:59 ` Thomas Gleixner
2018-01-17 11:00 ` tip-bot for Thomas Gleixner [this message]
2018-01-17 20:35 ` Joseph Salisbury
2018-01-17 22:16 ` Joseph Salisbury
2018-01-17 22:55 ` Thomas Gleixner
2018-01-17 22:59 ` Joseph Salisbury
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=tip-d47924417319e3b6a728c0b690f183e75bc2a702@git.kernel.org \
--to=tipbot@zytor.com \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=joseph.salisbury@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.v.shankar@intel.com \
--cc=rod.smith@canonical.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=vikas.shivappa@linux.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
all inboxes | Powered by JetHome®