]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.1.12/x86-resctrl-prevent-null-pointer-dereference-when-local-mbm-is-disabled.patch
Linux 5.1.12
[thirdparty/kernel/stable-queue.git] / releases / 5.1.12 / x86-resctrl-prevent-null-pointer-dereference-when-local-mbm-is-disabled.patch
1 From c7563e62a6d720aa3b068e26ddffab5f0df29263 Mon Sep 17 00:00:00 2001
2 From: Prarit Bhargava <prarit@redhat.com>
3 Date: Mon, 10 Jun 2019 13:15:44 -0400
4 Subject: x86/resctrl: Prevent NULL pointer dereference when local MBM is disabled
5
6 From: Prarit Bhargava <prarit@redhat.com>
7
8 commit c7563e62a6d720aa3b068e26ddffab5f0df29263 upstream.
9
10 Booting with kernel parameter "rdt=cmt,mbmtotal,memlocal,l3cat,mba" and
11 executing "mount -t resctrl resctrl -o mba_MBps /sys/fs/resctrl" results in
12 a NULL pointer dereference on systems which do not have local MBM support
13 enabled..
14
15 BUG: kernel NULL pointer dereference, address: 0000000000000020
16 PGD 0 P4D 0
17 Oops: 0000 [#1] SMP PTI
18 CPU: 0 PID: 722 Comm: kworker/0:3 Not tainted 5.2.0-0.rc3.git0.1.el7_UNSUPPORTED.x86_64 #2
19 Workqueue: events mbm_handle_overflow
20 RIP: 0010:mbm_handle_overflow+0x150/0x2b0
21
22 Only enter the bandwith update loop if the system has local MBM enabled.
23
24 Fixes: de73f38f7680 ("x86/intel_rdt/mba_sc: Feedback loop to dynamically update mem bandwidth")
25 Signed-off-by: Prarit Bhargava <prarit@redhat.com>
26 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
27 Cc: Fenghua Yu <fenghua.yu@intel.com>
28 Cc: Reinette Chatre <reinette.chatre@intel.com>
29 Cc: Borislav Petkov <bp@alien8.de>
30 Cc: "H. Peter Anvin" <hpa@zytor.com>
31 Cc: stable@vger.kernel.org
32 Link: https://lkml.kernel.org/r/20190610171544.13474-1-prarit@redhat.com
33 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34
35 ---
36 arch/x86/kernel/cpu/resctrl/monitor.c | 3 +++
37 1 file changed, 3 insertions(+)
38
39 --- a/arch/x86/kernel/cpu/resctrl/monitor.c
40 +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
41 @@ -368,6 +368,9 @@ static void update_mba_bw(struct rdtgrou
42 struct list_head *head;
43 struct rdtgroup *entry;
44
45 + if (!is_mbm_local_enabled())
46 + return;
47 +
48 r_mba = &rdt_resources_all[RDT_RESOURCE_MBA];
49 closid = rgrp->closid;
50 rmid = rgrp->mon.rmid;