From patchwork Thu Aug 23 05:12:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 10573459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A58BA920 for ; Thu, 23 Aug 2018 05:14:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BEDF2BB20 for ; Thu, 23 Aug 2018 05:14:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 803632BB4F; Thu, 23 Aug 2018 05:14:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 447E62BB20 for ; Thu, 23 Aug 2018 05:14:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 720186B284D; Thu, 23 Aug 2018 01:14:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6CF876B284E; Thu, 23 Aug 2018 01:14:26 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E6666B284F; Thu, 23 Aug 2018 01:14:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 2A4D56B284D for ; Thu, 23 Aug 2018 01:14:26 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id l15-v6so2562944pff.1 for ; Wed, 22 Aug 2018 22:14:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version; bh=zh2M/lGC/xJ5C2jsrYO3a0U7C5UFB/XvNQgGYxE7mRQ=; b=CCTdJdz3SlZ82NuyEfU+Fg/W/sPckuD8pKiG+ci/Qb8CoyFwB0w7pAMG99fIMfrTxD sU5Y+MBGTsdWg4LqVOp3xScrMEzlerfvxckTifOC5HZyJiQFQz3n9H49FOT1/vQkG6AC JZmSRESqxAhqD4zfJRipPMJwUUSfZDh9vMill/M1eKho/puNvQTTBksqifXTIwIvGLn2 td2680Xj3v9gcOelhE+KjXjZgwMEa91VyXjse/ANy/YteUX5jKu2rvNEdzfCpYE1UL9R IC1f6AoGGHhEM+Vza98U4OVW1r1Yd7sab7Wcr5ASSs7xvHFoems7IPkPC1M5OuY+2EHo 307g== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of namit@vmware.com designates 208.91.0.189 as permitted sender) smtp.mailfrom=namit@vmware.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=vmware.com X-Gm-Message-State: AOUpUlHfvPMt9f/YjFHSwg7eajgzkDjA5nd+XqNarMgT4K1zkI3o2QVo J4rNf6vrkDmdwf6nmaAylh49aMfbn71m9NmXmbsgWGWcS5bPVTvuvaOA3wM2Lv5rPKeFM4QQqIS hRhpRY/3hF1S0bqGJNsT1MJWJK17o9qJ8p6RNagTg19TSZaTp2a5o7raGUCiJAC/+qg== X-Received: by 2002:a62:6c04:: with SMTP id h4-v6mr26486738pfc.113.1535001265850; Wed, 22 Aug 2018 22:14:25 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxeGIqp4XhhGezIbUNLGTqrqhDG3PqO1Sa8E2DfmQeO8mkl+bYjlH/Rb2FvytLduaM7gaz/ X-Received: by 2002:a62:6c04:: with SMTP id h4-v6mr26486703pfc.113.1535001265060; Wed, 22 Aug 2018 22:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535001265; cv=none; d=google.com; s=arc-20160816; b=CiDikerDgTPlVXmhbQ5rFOhW7M9mvfCeIYYPfR0OpBySjFUqvNhr+GPCpO4a0p1E58 q83Yw+fiUQ4VSiVBbqZ1pmqTGl7QWlpXHwhgWbSLgAvpTXiuJJ7E/gziUSAKjy2JQlf3 ejx/WDgZAsgoC7VMcQ66o3utY8ZVHpg3ptDJ8l83EUzmxh/xn/ZsUobzBZiuzfjPvXo4 QfDcW9PLV7Tzinh3vCZtQ4vmnUpGVcoIw+sbyD4lLvmdthfFZwko4KQ9Vk1sVOlUX05E EeDfxF6qGJuqc0kvE/EkU0uYCy6TQXtTRo4EUNpX4EhMeEddlMRvZHjJe8c0U2b7VeSh /Q2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:subject:cc:to:from :arc-authentication-results; bh=zh2M/lGC/xJ5C2jsrYO3a0U7C5UFB/XvNQgGYxE7mRQ=; b=xJVTTiqleHx4hwD2WB74zKQzBjsyncirK17lNjPsQRzwtdwHvg/fzn81bUmQTC+AIZ XspBKfkl0Vr5vudCVN4IgGdL77/2+GdqDQKqdRCE4nJNZuIBS+IXOnAvTlm6kgswwz4n 8YBqyMUvfNMq1FYTqixTHVSABJHMd0KlSUm4h0GyVb5XNEDMkJo6hxjDfC/Wyo/shxgp /4UFuMx1irbOQMo9ycLOU3jxltcSvxgZiZYAWlR0H0UaKPXiQyC6I/PAG0i2PrbKcM1z eVib86vUYxuwfdYV1w8bLIdgRfleOsEbKjGi8WdLtl66RAWJ1bwBDJ6GErGJsndWJoLy kIfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of namit@vmware.com designates 208.91.0.189 as permitted sender) smtp.mailfrom=namit@vmware.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: from EX13-EDG-OU-001.vmware.com (ex13-edg-ou-001.vmware.com. [208.91.0.189]) by mx.google.com with ESMTPS id o6-v6si3293926pls.480.2018.08.22.22.14.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Aug 2018 22:14:25 -0700 (PDT) Received-SPF: pass (google.com: domain of namit@vmware.com designates 208.91.0.189 as permitted sender) client-ip=208.91.0.189; Authentication-Results: mx.google.com; spf=pass (google.com: domain of namit@vmware.com designates 208.91.0.189 as permitted sender) smtp.mailfrom=namit@vmware.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=vmware.com 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 Received-SPF: None (EX13-EDG-OU-001.vmware.com: namit@vmware.com does not designate permitted sender hosts) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Michal Hocko --- 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);