Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1115072ybj; Fri, 20 Sep 2019 05:28:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPKmqvnwMKX4bI0Vz1El3P/P9ZA1EPvyTpLMLyFAxso5b0kiAvQyNvdPBtjyLKBRWR30kF X-Received: by 2002:a50:b6aa:: with SMTP id d39mr21195208ede.16.1568982480654; Fri, 20 Sep 2019 05:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568982480; cv=none; d=google.com; s=arc-20160816; b=lyP1DZhYhMbLL2fa1W8Vg3qz3AJtEE6KiqhRj/3/1rb57duwN/SxXq0/FTXMgz3W0W qdfE4bW1LcAF7gCdYV8TEfp/sX/bxpPNkeHGAkSSkP+YuuQ4P7e4D0fgDEJh9itJ1Bpd AWPcubmgJ+hBjFWwWLFBSZtxI6MU7+q7pxqyE1EfZkSNA1NddpV882j/jSTv0Tn1k6eB fRC2ra1OcL1IMorRXPIMhVAlG9GAWJSLdF44STq+LaRFQ+OCKKwxEKeqz1yTaHVWvrOg JuYLjAUD0ZY4+KltRZ7u9Pf3LJYwsj0qnxNbEtXGIxI5XRcMv9isZdJ2JVGHF/vH69on 9zsw== 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=jo8dCjwejl7hV9wpSt/1a+733+Jp/iN8ecP5iadTznk=; b=t0eegATTV2ub7fyyCc/COG1tI5RFpjmkGuN9/+dvgKOGE4LPfNkGxBvPFdYRPTHjcI Ewk8doXQvKYd9L+SWoxPW8httoDV5kplKjahJyf3Ob27z3Ov8jNDbbVZLcnIq28o1n2c TEKMOHBzW9N7xoDc5NjGptyr8LVLSUBAP88UHwfSfth4C459oVFn+idcHtVQ0cnfmcll f22PWCiYHZ2L6IzTUsNJAqbyojJtouum2T3asBTE4zNyxc8apcCCZdQGWFnv9NNpS0Xy VBbaOTMJdP2KMATlcxUHcrxIFqEDXSSlT/yYuv6e3ajgxyJsUAVOXfCBkjRrcyHGk5Nt 47LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="B6V/m6qV"; 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 n4si879826ejj.132.2019.09.20.05.27.37; Fri, 20 Sep 2019 05:28:00 -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="B6V/m6qV"; 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 S2392428AbfISWQb (ORCPT + 99 others); Thu, 19 Sep 2019 18:16:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:56928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392317AbfISWQ1 (ORCPT ); Thu, 19 Sep 2019 18:16:27 -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 A43E521927; Thu, 19 Sep 2019 22:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931387; bh=HM89y0GM3yQ9uGNFebzaFnpLm1dfQiI9Y1XTs/Ja0fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B6V/m6qVTdy9Jqv9q6fmda+ikHDHvaSdXlHTUQ0SzklJLV3z1fKXpUdgKyyP/6P7t ap5eLiVXkfAIcoj5dwbAuYbRvwjIt2L/tnkEHIh4/+xI9cjzxO/JkYR0G5USFAG0QT Rt4wFBGEK3sjWRO618wweKSFkZmBCxljJs+1hP38= 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.14 27/59] ARM: 8874/1: mm: only adjust sections of valid mm structures Date: Fri, 20 Sep 2019 00:03:42 +0200 Message-Id: <20190919214805.014893472@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214755.852282682@linuxfoundation.org> References: <20190919214755.852282682@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 defb7fc264280..4fa12fcf1f5d8 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -722,7 +722,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); } set_section_perms(perms, n, true, current->active_mm); set_section_perms(perms, n, true, &init_mm); -- 2.20.1