From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753306AbdKWTmP (ORCPT ); Thu, 23 Nov 2017 14:42:15 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:40709 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753229AbdKWTmO (ORCPT ); Thu, 23 Nov 2017 14:42:14 -0500 X-Google-Smtp-Source: AGs4zMbt/eYyZaisQZiOpddDV/BHTyNQRpScvVmPO0Z/L3mwcpSB2E6BRdGeHFHiZv+uu5kXh9SryA== Date: Thu, 23 Nov 2017 11:42:10 -0800 From: Eric Biggers To: Dave Hansen Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, moritz.lipp@iaik.tugraz.at, daniel.gruss@iaik.tugraz.at, michael.schwarz@iaik.tugraz.at, richard.fellner@student.tugraz.at, luto@kernel.org, torvalds@linux-foundation.org, keescook@google.com, hughd@google.com, x86@kernel.org Subject: Re: [PATCH 09/23] x86, kaiser: map dynamically-allocated LDTs Message-ID: <20171123194210.GA2304@zzz.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171123003455.275397F7@viggo.jf.intel.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > diff -puN arch/x86/kernel/ldt.c~kaiser-user-map-new-ldts arch/x86/kernel/ldt.c > --- a/arch/x86/kernel/ldt.c~kaiser-user-map-new-ldts 2017-11-22 15:45:49.059619739 -0800 > +++ b/arch/x86/kernel/ldt.c 2017-11-22 15:45:49.062619739 -0800 > @@ -11,6 +11,7 @@ [...] > + ret = kaiser_add_mapping((unsigned long)new_ldt->entries, alloc_size, > + __PAGE_KERNEL | _PAGE_GLOBAL); > + if (ret) { > + __free_ldt_struct(new_ldt); > + return NULL; > + } > new_ldt->nr_entries = num_entries; > return new_ldt; __free_ldt_struct() uses new_ldt->nr_entries, so new_ldt->nr_entries needs to be set earlier. Eric