Skip to content

Commit 7f41419

Browse files
committed
x86/ldt: Make LDT pgtable free conditional
Andy prefers to be paranoid about the pagetable free in the error path of write_ldt(). Make it conditional and warn whenever the installment of a secondary LDT fails. Requested-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent a62d698 commit 7f41419

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kernel/ldt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,8 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
426426
* already installed then the PTE page is already
427427
* populated. Mop up a half populated page table.
428428
*/
429-
free_ldt_pgtables(mm);
429+
if (!WARN_ON_ONCE(old_ldt))
430+
free_ldt_pgtables(mm);
430431
free_ldt_struct(new_ldt);
431432
goto out_unlock;
432433
}

0 commit comments

Comments
 (0)