kernel, oom: fix potential pgd_lock deadlock from __mmdrop
[cascardo/linux.git] / kernel / fork.c
index 48cafe7..5650e35 100644 (file)
@@ -359,8 +359,12 @@ static inline void free_signal_struct(struct signal_struct *sig)
 {
        taskstats_tgid_free(sig);
        sched_autogroup_exit(sig);
+       /*
+        * __mmdrop is not safe to call from softirq context on x86 due to
+        * pgd_dtor so postpone it to the async context
+        */
        if (sig->oom_mm)
-               mmdrop(sig->oom_mm);
+               mmdrop_async(sig->oom_mm);
        kmem_cache_free(signal_cachep, sig);
 }