Skip to content

Commit

Permalink
x86/ldt: Make LDT pgtable free conditional
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner committed Dec 31, 2017
1 parent a62d698 commit 7f41419
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/x86/kernel/ldt.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
* already installed then the PTE page is already
* populated. Mop up a half populated page table.
*/
free_ldt_pgtables(mm);
if (!WARN_ON_ONCE(old_ldt))
free_ldt_pgtables(mm);
free_ldt_struct(new_ldt);
goto out_unlock;
}
Expand Down

0 comments on commit 7f41419

Please sign in to comment.