Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp741045imm; Thu, 13 Sep 2018 07:06:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYHQNgo88fmBT0d0jRtupc5NqXndk/UlgRHxxbcQQrEqHJU5FsA1kQZrQKI9puV5lJclvOQ X-Received: by 2002:a63:5055:: with SMTP id q21-v6mr7357096pgl.397.1536847562872; Thu, 13 Sep 2018 07:06:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847562; cv=none; d=google.com; s=arc-20160816; b=OeOba33MnJUGMQnYJW/AwIFbRe5zeYZlpEBxMWi9rCu661dIpo0/EBgbSXy0rohtbO FFO5Nt8WC5n7ym8VkE3z/HwO6W4ZCIV7FIExS4/WUuxy4t5FvefAhhlWZFjIBa2yZxYM qroeiwI2ovUw+AEuFJcaesJ6Zwov3r6n6DjndVc/dauXnn85LStZwdzJ7yod99IVtmtM CNDuay+vSbPFTLPNzLk3Q2RQiQXvnDKrYrD81flRO3aCeVl1bLReGU14eAYtRZAm7V8P rrbEHM0kGzEFNC4Cd6WyNyP9alyPXANnzhUH6KFXJ7xtR3yivpDGdV2YV/3BrYRC/ojI uQKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=j0ttEb1YiacttoeAzKDO2S9R1h6tV0dD0Wi3R+uFsDM=; b=S2Em3pCsbP2+WtXtv+uB6iZrcCy3s3yseJvBkx2+yILrMcTEV7+YXgKNUr4lg/7UYW 09MugMQl8R7qnAGQhOZC2rYlwJX2y+l9zltcq1u/Gn7lAdw5FoLGMk7ubpDEQKocUA+9 3J+PO/u+3i2xEILydQmNf0BAbn7zmo/RNC8amZMLWu/Dsl4/LxRw4rB2PbgASLujhUjR CSbvlXBmBffAC4LMVu1bNusZfocuTF4YZCxCeSKcAn8P0/SUH1BY16CI1SGQ4YxNWRoZ LzN61Z4pOYIYOrL9VKvdle7LqBgtzZ/4i3LXPC+biqyHGfU9SZD/00GTZkS4QBAD6Ydo V0hg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15-v6si3971823plo.284.2018.09.13.07.05.42; Thu, 13 Sep 2018 07:06:02 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731866AbeIMTPJ (ORCPT + 99 others); Thu, 13 Sep 2018 15:15:09 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35492 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728095AbeIMTPI (ORCPT ); Thu, 13 Sep 2018 15:15:08 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D38F3D39; Thu, 13 Sep 2018 14:05:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nadav Amit , Michal Hocko , Andrew Morton , Linus Torvalds Subject: [PATCH 4.18 183/197] mm: respect arch_dup_mmap() return value Date: Thu, 13 Sep 2018 15:32:12 +0200 Message-Id: <20180913131848.884233380@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nadav Amit commit 1ed0cc5a01a4d868d9907ce96468c4b4c6709556 upstream. Commit d70f2a14b72a ("include/linux/sched/mm.h: uninline mmdrop_async(), etc") ignored the return value of arch_dup_mmap(). As a result, on x86, a failure to duplicate the LDT (e.g. due to memory allocation error) would leave the duplicated memory mapping in an inconsistent state. Fix by using the return value, as it was before the change. Link: http://lkml.kernel.org/r/20180823051229.211856-1-namit@vmware.com Fixes: d70f2a14b72a4 ("include/linux/sched/mm.h: uninline mmdrop_async(), etc") Signed-off-by: Nadav Amit Acked-by: Michal Hocko Cc: Signed-off-by: Greg Kroah-Hartman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/fork.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/kernel/fork.c +++ b/kernel/fork.c @@ -549,8 +549,7 @@ static __latent_entropy int dup_mmap(str goto out; } /* a new mm has just been created */ - arch_dup_mmap(oldmm, mm); - retval = 0; + retval = arch_dup_mmap(oldmm, mm); out: up_write(&mm->mmap_sem); flush_tlb_mm(oldmm);