Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2982164imu; Mon, 19 Nov 2018 08:57:54 -0800 (PST) X-Google-Smtp-Source: AJdET5dmveeOesSY10tQZ6EAyWSH14KaKjPnk+ufyuY2pMtq5xZ5F85EIfMQyADWE/rs62B/nz3t X-Received: by 2002:a62:8c11:: with SMTP id m17mr16324520pfd.224.1542646674756; Mon, 19 Nov 2018 08:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542646674; cv=none; d=google.com; s=arc-20160816; b=jrUKTD6pECCyzPJ/aEE+VMa/3UVdCSLpqrHrBmsI27erDpdg0qTPDrdb/HNRptGkLg 4T3PNaB1SQT74EIElX06HgEnzVrPhS1ATUbCPPMgSBr82kTvdGMPaL4XH5qIK5Wq/BNN o3uhzRV9WfMfkrEVuYhrcTOnGTEt/Ys3EmFNv9WuU64KOz7G2wcCdC80OvR7aleIQcoR yNMQ9Ufw9jdpif0oUGUZMbFvcwjrsQu6IxT0Zyz6oAT9DIzrjzT4xBLmmpAoD2B131ED QEpIVHMT2JcZcRuNB8gJWOByZFWGXW/htU9eFEaQBiDlJn0Rtl6a9ZYlTHbKZZeHUsV4 5SeA== 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=gQfA9eDAbjOWnAGWHpy+VXVoFuQqKWe+2WqC/DpVIQE=; b=wLwVHDwpe2fFWTW4gXV9Vr5s0/LzNKbKwjDehogmHSkztmaRSRx4E+x0eYmtgkUqsW DbmFCV5h00dN84gB0tqlUSExjiSc3ALannWRTqVb2g1wJ4e/IcxIYjvecfa0VKK2+lMU ToxRp1g6iGjhVF5omQdMmSpy4Oj9R6sBFHJ+VBmHtCZta0YxXe5uWWDebK0ypTKfGuld kKJnJgICM/SHLMwmmxm+u45rFHsvM+sR4Jl8oq3QC+bMPHkMQbAajBZNfOGXiIUqqkwR bLkWtHvkjwG6BdJ4gkNbNxgW0rOXTW964w7K8eBLb1Da2DfT4F7UQdaF474RYy1aJgoY w0rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="2Wiy/laA"; 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 d4-v6si41148328pla.203.2018.11.19.08.57.40; Mon, 19 Nov 2018 08:57:54 -0800 (PST) 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="2Wiy/laA"; 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 S2404434AbeKTDVS (ORCPT + 99 others); Mon, 19 Nov 2018 22:21:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:60906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403835AbeKTDVS (ORCPT ); Mon, 19 Nov 2018 22:21:18 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 C1B75206BA; Mon, 19 Nov 2018 16:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542646623; bh=QHD4vUgIigSFgjbMgRaLa3Zu29sCKDPulmj+pNlYagU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Wiy/laA7UHnAnSS1RiReBDnhsg789eyaPsGKTvBgzbHYuqou2Ui5oci6F7oUw1aP hOdJuz7V6zzJVGsHGGFNotPWiSs0X7X+aZTJqJxWY9V3PVmbYXAs7f1x3x5WJXOuXJ E3YAduvwQCbrspnHHN5/24t8WSAyEEhHQbdjgn8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 4.4 007/160] parisc: Fix map_pages() to not overwrite existing pte entries Date: Mon, 19 Nov 2018 17:27:26 +0100 Message-Id: <20181119162630.903225047@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162630.031306128@linuxfoundation.org> References: <20181119162630.031306128@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Helge Deller commit 3c229b3f2dd8133f61bb81d3cb018be92f4bba39 upstream. Fix a long-existing small nasty bug in the map_pages() implementation which leads to overwriting already written pte entries with zero, *if* map_pages() is called a second time with an end address which isn't aligned on a pmd boundry. This happens for example if we want to remap only the text segment read/write in order to run alternative patching on the code. Exiting the loop when we reach the end address fixes this. Cc: stable@vger.kernel.org Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- arch/parisc/mm/init.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c @@ -491,12 +491,8 @@ static void __init map_pages(unsigned lo pte = pte_mkhuge(pte); } - if (address >= end_paddr) { - if (force) - break; - else - pte_val(pte) = 0; - } + if (address >= end_paddr) + break; set_pte(pg_table, pte);