Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlaf Hering <ohering@suse.de>2016-07-18 15:39:29 +0200
committerOlaf Hering <ohering@suse.de>2016-07-18 15:39:49 +0200
commit0b50c2cebc590164ffda01fe477ccc57bcfad34d (patch)
treed9d3c6f8fcc2b6721183a94f7c75e106ea41afd3
parent27928d1d14060798563d313a750eef67d9132f29 (diff)
Drivers: hv: avoid vfree() on crash (fate#320485, bnc#988281).rpm-4.4.15-53
-rw-r--r--patches.suse/suse-hv-avoid-vfree-on-crash.patch106
-rw-r--r--series.conf1
2 files changed, 107 insertions, 0 deletions
diff --git a/patches.suse/suse-hv-avoid-vfree-on-crash.patch b/patches.suse/suse-hv-avoid-vfree-on-crash.patch
new file mode 100644
index 0000000000..40d6bf1065
--- /dev/null
+++ b/patches.suse/suse-hv-avoid-vfree-on-crash.patch
@@ -0,0 +1,106 @@
+From: Vitaly Kuznetsov <vkuznets@redhat.com>
+Date: Fri, 3 Jun 2016 17:09:22 -0700
+Patch-mainline: submitted (lkml - https://lkml.org/lkml/2016/5/25/157)
+Subject: [PATCH 1/3] Drivers: hv: avoid vfree() on crash
+Reference: fate#320485, bnc#988281
+
+When we crash from NMI context (e.g. after NMI injection from host when
+'sysctl -w kernel.unknown_nmi_panic=1' is set) we hit
+
+ kernel BUG at mm/vmalloc.c:1530!
+
+as vfree() is denied. While the issue could be solved with in_nmi() check
+instead I opted for skipping vfree on all sorts of crashes to reduce the
+amount of work which can cause consequent crashes. We don't really need to
+free anything on crash.
+
+Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
+Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
+Acked-by: <ohering@suse.de>
+
+---
+ drivers/hv/hv.c | 8 +++++---
+ drivers/hv/hyperv_vmbus.h | 2 +-
+ drivers/hv/vmbus_drv.c | 8 ++++----
+ 3 files changed, 10 insertions(+), 8 deletions(-)
+
+--- a/drivers/hv/hv.c
++++ b/drivers/hv/hv.c
+@@ -278,7 +278,7 @@ cleanup:
+ *
+ * This routine is called normally during driver unloading or exiting.
+ */
+-void hv_cleanup(void)
++void hv_cleanup(bool crash)
+ {
+ union hv_x64_msr_hypercall_contents hypercall_msr;
+
+@@ -288,7 +288,8 @@ void hv_cleanup(void)
+ if (hv_context.hypercall_page) {
+ hypercall_msr.as_uint64 = 0;
+ wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
+- vfree(hv_context.hypercall_page);
++ if (!crash)
++ vfree(hv_context.hypercall_page);
+ hv_context.hypercall_page = NULL;
+ }
+
+@@ -308,7 +309,8 @@ void hv_cleanup(void)
+
+ hypercall_msr.as_uint64 = 0;
+ wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
+- vfree(hv_context.tsc_page);
++ if (!crash)
++ vfree(hv_context.tsc_page);
+ hv_context.tsc_page = NULL;
+ }
+ #endif
+--- a/drivers/hv/hyperv_vmbus.h
++++ b/drivers/hv/hyperv_vmbus.h
+@@ -495,7 +495,7 @@ struct hv_ring_buffer_debug_info {
+
+ extern int hv_init(void);
+
+-extern void hv_cleanup(void);
++extern void hv_cleanup(bool crash);
+
+ extern int hv_post_message(union hv_connection_id connection_id,
+ enum hv_message_type message_type,
+--- a/drivers/hv/vmbus_drv.c
++++ b/drivers/hv/vmbus_drv.c
+@@ -871,7 +871,7 @@ err_alloc:
+ bus_unregister(&hv_bus);
+
+ err_cleanup:
+- hv_cleanup();
++ hv_cleanup(false);
+
+ return ret;
+ }
+@@ -1323,7 +1323,7 @@ static void hv_kexec_handler(void)
+ vmbus_initiate_unload(false);
+ for_each_online_cpu(cpu)
+ smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
+- hv_cleanup();
++ hv_cleanup(false);
+ };
+
+ static void hv_crash_handler(struct pt_regs *regs)
+@@ -1335,7 +1335,7 @@ static void hv_crash_handler(struct pt_r
+ * for kdump.
+ */
+ hv_synic_cleanup(NULL);
+- hv_cleanup();
++ hv_cleanup(true);
+ };
+
+ static int __init hv_acpi_init(void)
+@@ -1395,7 +1395,7 @@ static void __exit vmbus_exit(void)
+ &hyperv_panic_block);
+ }
+ bus_unregister(&hv_bus);
+- hv_cleanup();
++ hv_cleanup(false);
+ for_each_online_cpu(cpu) {
+ tasklet_kill(hv_context.event_dpc[cpu]);
+ smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
diff --git a/series.conf b/series.conf
index 832ddcba53..5ada10e5f9 100644
--- a/series.conf
+++ b/series.conf
@@ -1587,6 +1587,7 @@
patches.suse/msft-hv-1051-hv_netvsc-synchronize-netvsc_change_mtu-netvsc_set_c.patch
patches.suse/msft-hv-1052-hv_netvsc-set-nvdev-link-after-populating-chn_table.patch
+ patches.suse/suse-hv-avoid-vfree-on-crash.patch
patches.suse/suse-hv-scsi-storvsc-Filter-out-storvsc-messages-CD-ROM-medi.patch
patches.suse/suse-hv--hv_netvsc-Fix-VF-register-on-vlan-devices.patch
patches.suse/suse-hv-hyperv_fb-Add-screen-refresh-after-pause-resume-oper.patch