Merge branch 'x86/asm' into x86/atomic
[sfrench/cifs-2.6.git] / arch / x86 / kernel / alternative.c
index 936738427223e40e9a48ba254aee7b7e5a71a143..70237732a6c7c5f62f941d5df0594f7386ca6a10 100644 (file)
@@ -247,7 +247,8 @@ static void alternatives_smp_lock(const s32 *start, const s32 *end,
                if (!*poff || ptr < text || ptr >= text_end)
                        continue;
                /* turn DS segment override prefix into lock prefix */
-               text_poke(ptr, ((unsigned char []){0xf0}), 1);
+               if (*ptr == 0x3e)
+                       text_poke(ptr, ((unsigned char []){0xf0}), 1);
        };
        mutex_unlock(&text_mutex);
 }
@@ -267,7 +268,8 @@ static void alternatives_smp_unlock(const s32 *start, const s32 *end,
                if (!*poff || ptr < text || ptr >= text_end)
                        continue;
                /* turn lock prefix into DS segment override prefix */
-               text_poke(ptr, ((unsigned char []){0x3E}), 1);
+               if (*ptr == 0xf0)
+                       text_poke(ptr, ((unsigned char []){0x3E}), 1);
        };
        mutex_unlock(&text_mutex);
 }