Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3489551imu; Sun, 11 Nov 2018 16:15:44 -0800 (PST) X-Google-Smtp-Source: AJdET5dD8bBhHS3VzeTgrT0uj7CgxnwOgiDZQOyt7rFis0ANrXhAMMl9Yxz+dEnD0mg+Ah2g7acP X-Received: by 2002:a63:4d66:: with SMTP id n38mr15612076pgl.270.1541981744174; Sun, 11 Nov 2018 16:15:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981744; cv=none; d=google.com; s=arc-20160816; b=Z2rRySfR3WrTHV4z747k9CIIWwjFmqWkoOI3iI9hjg9gIGapO3d4qMLy4IEFeq+Vws 4qTpeoVLUR0cS1k6Mo/18INpmJOxF/u//X86xcpaoyqxSdvOnNnxoLncqpZos8q0gJHr ASd8wcsHi8WprMX7afGlw+s7WP5rA7vGwsCQTkWnSMw5PCgwqwgBXI6cs7p684dwmnZV tsULgI3lx34ygM8BJzqRCwD8ME8RxMQDVUsabywKBUm6oNfm1KFkvLcn+VAhuo2N5qie atTokQp2kZghPR73Xf/fLRG3++0o6Sgg7vkLlfRE0GfzCF9lLByItSCTle7H5A87nyPP F3FQ== 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=akS1rXikieN2bfLHbSo/Vvfm0fIqtVSVsVzcD/yTD+c=; b=NGaLCxWJRFyP22CiDhcLlnNEQkE2AQe5UZ/vlYEaDkQ1RAMCXJZrqesTBBoLHY9aA5 ByKo4a/N6jmbiquHJn3ehDLHTALTojgMu0OlXSaI72lz40Ojfn5oDW+47bNIo4/tKI29 uI026oZZerGONCOjvRzcp7SlDRalL48IM8DVxnhRCI6iRn4eul0eE5h0gFC3bTK0zDSe bi2wzbb6UAPOJcuQ6Vi5CWhiTkyt+abF9uldoYl3lbETbw9jVAyoCNAsXzsDZwXW2O5Y VxREW30HPxGgFTQEbndRqVjvx4di8m8+rVJW2OQDsG5TW9b5BYJNkc4qWsfiR5ZhgLom Qocw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bs9rCOal; 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 h3si15152663pgi.391.2018.11.11.16.15.29; Sun, 11 Nov 2018 16:15:44 -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=bs9rCOal; 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 S1731079AbeKLKFf (ORCPT + 99 others); Mon, 12 Nov 2018 05:05:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:59904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730297AbeKLIRK (ORCPT ); Mon, 12 Nov 2018 03:17:10 -0500 Received: from localhost (unknown [206.108.79.134]) (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 03EA7208A3; Sun, 11 Nov 2018 22:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975235; bh=QSh9L7FegNLmRoPi6+Kyatn3fuSL/w8BnQ2A8cvU/js=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bs9rCOaliG6UiELDVEFbwfCYtwnqvJynzUSmglghbEJliKhn1YXJG9LsK44r53/r1 DQn+HrRnW4aDABAZ6zZZw0JmuU04e7sef1abckVE8vpYcfHypwz5vMUds9qZysGj3P vkzw8zfomKxMDbFXWRonWzY54aga1DNXK5EBK78U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 4.19 032/361] parisc: Fix map_pages() to not overwrite existing pte entries Date: Sun, 11 Nov 2018 14:16:19 -0800 Message-Id: <20181111221624.144607062@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@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.19-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 @@ -494,12 +494,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);