mm: change mm_update_next_owner() to update mm->owner with WRITE_ONCE
[sfrench/cifs-2.6.git] / kernel / exit.c
index 2166c2d92ddc0c8a0af6e5a1dd833fe0243fd06a..8361a560cd1d10849469146d90894fb6c25064c4 100644 (file)
@@ -422,7 +422,7 @@ retry:
         * freed task structure.
         */
        if (atomic_read(&mm->mm_users) <= 1) {
-               mm->owner = NULL;
+               WRITE_ONCE(mm->owner, NULL);
                return;
        }
 
@@ -462,7 +462,7 @@ retry:
         * most likely racing with swapoff (try_to_unuse()) or /proc or
         * ptrace or page migration (get_task_mm()).  Mark owner as NULL.
         */
-       mm->owner = NULL;
+       WRITE_ONCE(mm->owner, NULL);
        return;
 
 assign_new_owner:
@@ -483,7 +483,7 @@ assign_new_owner:
                put_task_struct(c);
                goto retry;
        }
-       mm->owner = c;
+       WRITE_ONCE(mm->owner, c);
        task_unlock(c);
        put_task_struct(c);
 }