Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1215016imm; Wed, 22 Aug 2018 22:15:46 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxr/14Uqb+Mu96+pV0p5ieS6zRnznyBFG3ClyvlVepiwd5pb1ctkCjdZm47cZo9oVrGDzor X-Received: by 2002:a63:2acc:: with SMTP id q195-v6mr22606591pgq.291.1535001346753; Wed, 22 Aug 2018 22:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535001346; cv=none; d=google.com; s=arc-20160816; b=TJwn4raTBG8Tx73PhqLMDVqeNn4wCDHUsm6whxuHmR9wUAKL1xGc0m2hhV0tBFjAHJ V7QrwjKx5/zjhSZeS34bzipKqyMFdG2Tl/DAVsWVwy3I4+jjtrmXBzmTmk8U1E6uCTiz hYazAL3ApZgxCwV1qa0GyKoFrG84lJqGogevmqCAYgIFmHwRczhYnhV3RBsiz9bP7FYA nkzzCq8dgKkF6oKzVdvzCVHR2qsL1GIVtCBiNG5zs9ZEJ9W+sAAQ7/KxL3V61DbMADw2 UPi2wjLBFe/piCk5qux094gP6BEJE7DBUtg1OtOlVbQyleG+oObUbbX9W1jfOMMXtBjK eo9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=zh2M/lGC/xJ5C2jsrYO3a0U7C5UFB/XvNQgGYxE7mRQ=; b=Fz+ukSdeWScui9eQBKIoKDXocrpsr5UIaFRz3kk7KimIMbR4CJ+gv6wB88uB5Toy3P pbWzaqDnPtxc7Qd2t2C6f9AOorpbVD1BeEAAvbNtTnvDQuL7tibgUrdwZpL0T/Ee907e bZnyQWygKsurcc4S6RzAF2Q5nujZzg0xYHIK7kNNi5Wjixw8UFrgTSlnuT46uVHOOcs8 OZyIEVRVHPqn5igfi4uPBGuAwqa6gq61gRmtnmMiIOm1oQofJ0KUC+hnD2UxqTjgsyT9 PQFpLdOEdQzIA9QvtQ/+wVuSLVGGhGJjnD93GwLpkoLC6FA0Ztxu1s7/RBg7mSeHLC7f asHQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e37-v6si3472232plb.313.2018.08.22.22.15.31; Wed, 22 Aug 2018 22:15:46 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728484AbeHWImR (ORCPT + 99 others); Thu, 23 Aug 2018 04:42:17 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:58674 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728374AbeHWImR (ORCPT ); Thu, 23 Aug 2018 04:42:17 -0400 Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Wed, 22 Aug 2018 22:14:15 -0700 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 437B1B09EB; Thu, 23 Aug 2018 01:14:24 -0400 (EDT) From: Nadav Amit To: Michal Hocko CC: , , Nadav Amit , Andrew Morton , Subject: [PATCH] mm: respect arch_dup_mmap() return value Date: Wed, 22 Aug 2018 22:12:29 -0700 Message-ID: <20180823051229.211856-1-namit@vmware.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-001.vmware.com: namit@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit d70f2a14b72a4 ("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 regarding the return value, as it was before the change. Fixes: d70f2a14b72a4 ("include/linux/sched/mm.h: uninline mmdrop_async(), etc") Cc: Andrew Morton Cc: stable@vger.kernel.org Signed-off-by: Nadav Amit --- kernel/fork.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index 1b27babc4c78..4527d1d331de 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -549,8 +549,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, 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); -- 2.17.1