Skip to contentSkip to conversation

Fix NX-related Oops in wistron_btns module

PATCH New Jakub Bogusz 1 participant 1 message Nov 16, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix NX-related Oops in wistron_btns module

The attached patch fixes "kernel tried to execute NX-protected page" Oops when loading wistron_btns module, occurring since at least 3.4.x; still applies to Linux 3.12.

Signature · 1 line
Jakub Bogusz    http://qboosh.pl/

This patch fixes "kernel tried to execute NX-protected page" oops when loading winstron-btns module.

drivers/input/misc/wistron_btns.c renamed from drivers/input/misc/wistron_btns.c.orig +3 -0
@@ -33,6 +33,7 @@
 #include <linux/types.h>
 #include <linux/platform_device.h>
 #include <linux/leds.h>
+#include <asm/cacheflush.h>
 
 /* How often we poll keys - msecs */
 #define POLL_INTERVAL_DEFAULT	500 /* when idle */
@@ -124,6 +125,7 @@
 	if (entry_point >= 0xF0000) {
 		bios_code_map_base = base;
 		bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF);
+		set_memory_x((unsigned long)bios_code_map_base, 0x10000 >> PAGE_SHIFT);
 	} else {
 		iounmap(base);
 		bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000);
@@ -134,6 +136,7 @@
 			goto err;
 		}
 		bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF);
+		set_memory_x((unsigned long)bios_code_map_base, 0x4000 >> PAGE_SHIFT);
 	}
 	/* The Windows driver maps 0x10000 bytes, we keep only one page... */
 	bios_data_map_base = ioremap(0x400, 0xc00);