diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/alternative.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 4c80f155743..092a7b8be68 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/kprobes.h> | 5 | #include <linux/kprobes.h> |
6 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
7 | #include <linux/vmalloc.h> | 7 | #include <linux/vmalloc.h> |
8 | #include <linux/memory.h> | ||
8 | #include <asm/alternative.h> | 9 | #include <asm/alternative.h> |
9 | #include <asm/sections.h> | 10 | #include <asm/sections.h> |
10 | #include <asm/pgtable.h> | 11 | #include <asm/pgtable.h> |
@@ -226,6 +227,7 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end) | |||
226 | { | 227 | { |
227 | u8 **ptr; | 228 | u8 **ptr; |
228 | 229 | ||
230 | mutex_lock(&text_mutex); | ||
229 | for (ptr = start; ptr < end; ptr++) { | 231 | for (ptr = start; ptr < end; ptr++) { |
230 | if (*ptr < text) | 232 | if (*ptr < text) |
231 | continue; | 233 | continue; |
@@ -234,6 +236,7 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end) | |||
234 | /* turn DS segment override prefix into lock prefix */ | 236 | /* turn DS segment override prefix into lock prefix */ |
235 | text_poke(*ptr, ((unsigned char []){0xf0}), 1); | 237 | text_poke(*ptr, ((unsigned char []){0xf0}), 1); |
236 | }; | 238 | }; |
239 | mutex_unlock(&text_mutex); | ||
237 | } | 240 | } |
238 | 241 | ||
239 | static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end) | 242 | static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end) |
@@ -243,6 +246,7 @@ static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end | |||
243 | if (noreplace_smp) | 246 | if (noreplace_smp) |
244 | return; | 247 | return; |
245 | 248 | ||
249 | mutex_lock(&text_mutex); | ||
246 | for (ptr = start; ptr < end; ptr++) { | 250 | for (ptr = start; ptr < end; ptr++) { |
247 | if (*ptr < text) | 251 | if (*ptr < text) |
248 | continue; | 252 | continue; |
@@ -251,6 +255,7 @@ static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end | |||
251 | /* turn lock prefix into DS segment override prefix */ | 255 | /* turn lock prefix into DS segment override prefix */ |
252 | text_poke(*ptr, ((unsigned char []){0x3E}), 1); | 256 | text_poke(*ptr, ((unsigned char []){0x3E}), 1); |
253 | }; | 257 | }; |
258 | mutex_unlock(&text_mutex); | ||
254 | } | 259 | } |
255 | 260 | ||
256 | struct smp_alt_module { | 261 | struct smp_alt_module { |