aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-12-31 10:52:15 -0500
committerThomas Gleixner <tglx@linutronix.de>2017-12-31 10:55:09 -0500
commit7f414195b0c3612acd12b4611a5fe75995cf10c7 (patch)
tree0fb83d6e1283ec3e3963e14d34573c22e474bbdd
parenta62d69857aab4caa43049e72fe0ed5c4a60518dd (diff)
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>
-rw-r--r--arch/x86/kernel/ldt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index 500e90e44f86..26d713ecad34 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -426,7 +426,8 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
426 * already installed then the PTE page is already 426 * already installed then the PTE page is already
427 * populated. Mop up a half populated page table. 427 * populated. Mop up a half populated page table.
428 */ 428 */
429 free_ldt_pgtables(mm); 429 if (!WARN_ON_ONCE(old_ldt))
430 free_ldt_pgtables(mm);
430 free_ldt_struct(new_ldt); 431 free_ldt_struct(new_ldt);
431 goto out_unlock; 432 goto out_unlock;
432 } 433 }