Received: by 10.223.185.116 with SMTP id b49csp3207673wrg; Mon, 5 Mar 2018 16:33:37 -0800 (PST) X-Google-Smtp-Source: AG47ELsj5X4CMcFJhEbqnTvPAFjeqpUfS79roc/tKVwCCQiNwxhxaWFvn5N6bujId5LjO/gCZoGs X-Received: by 10.99.117.24 with SMTP id q24mr13445232pgc.53.1520296417096; Mon, 05 Mar 2018 16:33:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520296417; cv=none; d=google.com; s=arc-20160816; b=P6TVHfUxHTUlgmhb7zgSsrC5kI+UV125FxoaR0ZkPEA1/oI2kHD8H+3SK99N/CQEcO 719D+KFz8wnmr9VS080zHS38pAhtan1Oy9pathhWPMK2MeuPEFi5qy+/bfCoj/rKV/YB 38RO022rwZUg48wsOKKziLoE95ket+YcTPrgy8jV5QRpK5YvLVA74xk02vtpsvmtM1V7 mMkTOTCep3kU7xM/DQ719Uq/zhvjSb3OJVqFnD0UjiXLsNPc2ycUEOvgs5VbzDt2NAel zG16fttxpWfsdz8V1Q3bzZkmlFyaS0FGrC15vKX2Dw5XzVMIMsDgd3GFb8h3KaeX6xJ9 +eLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=vi0VZoGAFhCfrSxBvDY5GR8VcKgzmnREi6IaVyZOzIw=; b=0eoeS9HXswbYfs1EbfwHgHaxOXR14JXyyQzBg3qVBJwdtwmRR8+GPXq7OIxgPB+PD0 byV0zMZ8oDN8SGB/74y0kgSAD3CoMoMuSoz6PDPc0m3eliT8a37Mi+VDYPCGQWKvA2xR NDuA5rzxu7D3FRuplZF+7tVxAFd2TmnQ9cDyvdVfA8/3CjVhF8YTi9szjd8sNr1i2fL2 TR4gr1bYlExCji+UQlham4gKXMGg8aS+5EY8NDnM4ZOf75Zc/AKxMP2NE9RzaNTz1FtW CbmAKb7zeXDzWUwPsYu/Bo4drCWNuSB/LaVTI3DcDGkAuxbF4lGt67wDB4Nvk2A3754M qtQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=RQRVqwyf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si11120177pfl.224.2018.03.05.16.33.23; Mon, 05 Mar 2018 16:33:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=RQRVqwyf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933540AbeCFAbw (ORCPT + 99 others); Mon, 5 Mar 2018 19:31:52 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40904 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933409AbeCFA0r (ORCPT ); Mon, 5 Mar 2018 19:26:47 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w260LYM8187380; Tue, 6 Mar 2018 00:26:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=vi0VZoGAFhCfrSxBvDY5GR8VcKgzmnREi6IaVyZOzIw=; b=RQRVqwyfipN9gVv0Rtzf2+mSuY1JGMC3juUYxh7IWi8t/rCj9LD8rhQfjc7TfbEgERyY QX7Lh9uJ2D7dFD5GQYzHiozs7LleneSD17Zo1A/Sl/Hp5XukEWbGd2Ag9kTUQVlI6h/p Nl41dNaUI5ZVt0kSuqAAO/kltDr3XtnZ2yDypGHf72gPy99RdEGdr9zhlJHb/jEIds0W 1x/T38A8Mda8HbWRP75H03mUr26hHTQh04WLZHndE4lvibEkTNDNMbwImNrGQR0ziHXL uwkDa3s8aCs7yK03BhUg3lbwOBzUbfo35szLtGSvd7xIKGepIsLItUaSd9tF7CCIwI7Z OA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2ghdxf8jrt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:26:42 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w260QgD7011901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:26:42 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w260QfJu025237; Tue, 6 Mar 2018 00:26:42 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:26:41 -0800 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, Alexander.Levin@microsoft.com, dan.j.williams@intel.com, sathyanarayanan.kuppuswamy@intel.com, pankaj.laxminarayan.bharadiya@intel.com, akuster@mvista.com, cminyard@mvista.com, pasha.tatashin@oracle.com, gregkh@linuxfoundation.org, stable@vger.kernel.org Subject: [PATCH 4.1 48/65] kaiser: fix unlikely error in alloc_ldt_struct() Date: Mon, 5 Mar 2018 19:25:21 -0500 Message-Id: <20180306002538.1761-49-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306002538.1761-1-pasha.tatashin@oracle.com> References: <20180306002538.1761-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8823 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=887 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803060003 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugh Dickins An error from kaiser_add_mapping() here is not at all likely, but Eric Biggers rightly points out that __free_ldt_struct() relies on new_ldt->size being initialized: move that up. Signed-off-by: Hugh Dickins Acked-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 500943e57db8d3e298e98f595f835c5b613e843b) Signed-off-by: Pavel Tatashin --- arch/x86/kernel/ldt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c index c388247e0353..5797d437710d 100644 --- a/arch/x86/kernel/ldt.c +++ b/arch/x86/kernel/ldt.c @@ -78,11 +78,11 @@ static struct ldt_struct *alloc_ldt_struct(int size) ret = kaiser_add_mapping((unsigned long)new_ldt->entries, alloc_size, __PAGE_KERNEL); + new_ldt->size = size; if (ret) { __free_ldt_struct(new_ldt); return NULL; } - new_ldt->size = size; return new_ldt; } -- 2.16.2