x86/ldt: use vfree_atomic() to free ldt entries
authorAndrey Ryabinin <[email protected]>
Tue, 13 Dec 2016 00:44:17 +0000 (16:44 -0800)
committerLinus Torvalds <[email protected]>
Tue, 13 Dec 2016 02:55:08 +0000 (18:55 -0800)
vfree() is going to use sleeping lock.  free_ldt_struct() may be called
with disabled preemption, therefore we must use vfree_atomic() here.

E.g. call trace:
vfree()
free_ldt_struct()
destroy_context_ldt()
__mmdrop()
finish_task_switch()
schedule_tail()
ret_from_fork()

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andrey Ryabinin <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Cc: Joel Fernandes <[email protected]>
Cc: Jisheng Zhang <[email protected]>
Cc: Chris Wilson <[email protected]>
Cc: John Dias <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Ingo Molnar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
arch/x86/kernel/ldt.c

index 6707039b9032d98ebdb21b37769d4e400fa80cd0..4d12cdf2b4537d039e7da35566b235acfe04ef9e 100644 (file)
@@ -93,7 +93,7 @@ static void free_ldt_struct(struct ldt_struct *ldt)
 
        paravirt_free_ldt(ldt->entries, ldt->size);
        if (ldt->size * LDT_ENTRY_SIZE > PAGE_SIZE)
-               vfree(ldt->entries);
+               vfree_atomic(ldt->entries);
        else
                free_page((unsigned long)ldt->entries);
        kfree(ldt);