Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1284537ybj; Fri, 20 Sep 2019 08:03:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzX/4U6HMPdlW1iS0/xIg5yvKghhIUayRiTLNV/Ljkxyl6+N7coCwwVU4aexWFvevqJpqdy X-Received: by 2002:a17:906:4801:: with SMTP id w1mr11565348ejq.245.1568991839242; Fri, 20 Sep 2019 08:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568991839; cv=none; d=google.com; s=arc-20160816; b=eyT2lm3zN6jSQw1qksaZQMlOI3xBE1YorV/q8a1Vvfxc3Z1svN0+fUrvdwlDEcIWLL OIEpkGjQDreZi0BuDK4NLAHq+GSi5WYlWwqBplNz/ume+xBDDCzdMz8orVTyLBtl4+WT kMQ5xrVjiBaBhWhQN1PiWQqrZaYjXEPpWDNr8/6H9s9t9eVCG82HSC/BMC59HKid0PyC g6x8EcoD8e1EDBQuJmlamNXmeZAb4TWDm7DMMxYTZZuIbYm7bA/DyvfygWb9KhOBwdWv E+aAxtl3Jj57PSkynaCEw5GHkOrAfW+u6fK4Ge/AJDbT6TwsBz0mBqVKbTGfzQNvK7Lm aREg== 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:dkim-signature; bh=eyziapMfmTySFpdL4J4gkfx58Zww2ayllk0/HoOpfc8=; b=Ezv+Nur3nj25sgKm4qBcUPWWorp3QOLkfKZ9mS3XrYUpY9USreEInnyuqgNkxRyQFs r8QeyrXwMDE/hQ7M8ozl/8FebdGidcpxtL3gPPilB8mT4hUHhg7VIMtp4IzTjZ9EZRPD RGh7sD3MR925ItDDjcBbrhfbQ552lzrfUY66gyRfy9yPRpW6aq+aSYuDdth0y6gj3ptv +EpyRWnUk5xIxTX1bfOtG2vg/BBNL+Fs7lTLYWyXzK5Ft/7ubcFBJtOwKsYoNPjwu8+2 FzgobMZni0tXxRBGaoayoZK/tPSdVfA6qy6D/dN7fHZY/00Wdr7KJSYsLdHyKti5StdB z8Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ub/z6k+w"; 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 q28si1481557eda.322.2019.09.20.08.03.34; Fri, 20 Sep 2019 08:03:59 -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; dkim=pass header.i=@kernel.org header.s=default header.b="ub/z6k+w"; 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 S2405863AbfISWUS (ORCPT + 99 others); Thu, 19 Sep 2019 18:20:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:34188 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392769AbfISWUR (ORCPT ); Thu, 19 Sep 2019 18:20:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3AC1A21920; Thu, 19 Sep 2019 22:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931616; bh=U7yRzAYMW30TIjYy8RlK1FZ5pZc4dDGGUPsgsBmMOss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ub/z6k+wOCgbnST63uMJjCVdIF9vLfH8cHn3bSic4jgDBAhTka1mjXTmSZSNbXqk4 XAv4BqGYBM+5r5qeVvtw8uNvHaQzfbEy0gD/g+IA382o6bXqtZrHTQuvuy24eJ0ld6 cA0s23JIxuKi8Ll+sVLb6I/iMQY48mbL5j3zoMnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Berger , Laura Abbott , Mike Rapoport , Andrew Morton , Florian Fainelli , Rob Herring , "Steven Rostedt (VMware)" , Peng Fan , Geert Uytterhoeven , Russell King , Sasha Levin Subject: [PATCH 4.9 52/74] ARM: 8874/1: mm: only adjust sections of valid mm structures Date: Fri, 20 Sep 2019 00:04:05 +0200 Message-Id: <20190919214809.928390624@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214800.519074117@linuxfoundation.org> References: <20190919214800.519074117@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Doug Berger [ Upstream commit c51bc12d06b3a5494fbfcbd788a8e307932a06e9 ] A timing hazard exists when an early fork/exec thread begins exiting and sets its mm pointer to NULL while a separate core tries to update the section information. This commit ensures that the mm pointer is not NULL before setting its section parameters. The arguments provided by commit 11ce4b33aedc ("ARM: 8672/1: mm: remove tasklist locking from update_sections_early()") are equally valid for not requiring grabbing the task_lock around this check. Fixes: 08925c2f124f ("ARM: 8464/1: Update all mm structures with section adjustments") Signed-off-by: Doug Berger Acked-by: Laura Abbott Cc: Mike Rapoport Cc: Andrew Morton Cc: Florian Fainelli Cc: Rob Herring Cc: "Steven Rostedt (VMware)" Cc: Peng Fan Cc: Geert Uytterhoeven Signed-off-by: Russell King Signed-off-by: Sasha Levin --- arch/arm/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 1565d6b671636..4fb1474141a61 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -698,7 +698,8 @@ static void update_sections_early(struct section_perm perms[], int n) if (t->flags & PF_KTHREAD) continue; for_each_thread(t, s) - set_section_perms(perms, n, true, s->mm); + if (s->mm) + set_section_perms(perms, n, true, s->mm); } read_unlock(&tasklist_lock); set_section_perms(perms, n, true, current->active_mm); -- 2.20.1