Merge tag 'v3.10.107' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / x86 / kernel / ldt.c
index ebc9873989233dcba13d1fa1af14e3e921959a85..c37886d759ccac2736c36b357cc0f399786f2fb3 100644 (file)
@@ -229,6 +229,11 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
                }
        }
 
+       if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) {
+               error = -EINVAL;
+               goto out_unlock;
+       }
+
        fill_ldt(&ldt, &ldt_info);
        if (oldmode)
                ldt.avl = 0;