Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3442431imu; Sun, 11 Nov 2018 15:11:42 -0800 (PST) X-Google-Smtp-Source: AJdET5fFsS/+p8aXq0Gzfsh2MUeC0KGsWCPb3RVtuqtbPe34VChTDKn6MfedrnyAO8dc2cctoyGs X-Received: by 2002:a62:3387:: with SMTP id z129-v6mr8136307pfz.143.1541977902172; Sun, 11 Nov 2018 15:11:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977902; cv=none; d=google.com; s=arc-20160816; b=T6fauMAwLMelp4eXuL7gQtCHuBDaOhuKdvee8AzxRrT+PKGAw026B1iEm+vNTp568d bpogxQAAOmWAC6KYTe3Bpv9Gv9VfhoyzMX7yDO5FU1Sqt+82zD9gE7IjcLlOXK8SHXFK 8lPUskYR6rvgLJnqA5qlM4XrOTmzqL4SkDO5TTSGaXEG9zCGV4vNmUeid+TJf4GKZdCX bPC8zfkapv52X7phwkNDILvB2JzWHuvFAXUXIH3V2SUnQdVbsNUE6TyZaAFG1ytqlNqA 0gU94TqPpQZEQaO7OaQt5e7GJgsqzZN8UnT2eIkvUBrjb9s4HBT07McwiDSiMBN75gL9 YsEA== 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=bpkLLHWLPxNgbOJYBsW69db381V2glLf/Cdyxw01IxE=; b=jCHQgs/vw2rfftLqcprqt2LUQSuyHunvNCwbndvbyZO3Y1ZJNJoHkJz0cQc3UOmt6W ic/40kOn1/sAUmtwR3a/XOYgW5gkb0wPNwMdubu2w4qSd/lp3dxB0aUH3iaCCxOlHEjy +WQgUMeKA3TDwfnjwFR1jW7l3ABsQsYEs34Md+gWBZ0mM3nMc6wFoaoc/EY2ze68HfdY r0/Yn1gZaU2S5jH9Jv1G2FSDY4ezLFGRQpHXepIci5sEfaAOMex1BRk90dDzZaz97ajx sdVC2JmKLiNTG3rNO2VeXC5b28/n3hBjI8wWTMO5xQ3eR+IS+aeQZRCQYjubNgAN71yu u6Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AVNGPXDy; 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 65-v6si16702796pfl.220.2018.11.11.15.11.27; Sun, 11 Nov 2018 15:11:42 -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=AVNGPXDy; 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 S2390229AbeKLJBF (ORCPT + 99 others); Mon, 12 Nov 2018 04:01:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:50448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390148AbeKLIV6 (ORCPT ); Mon, 12 Nov 2018 03:21:58 -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 23BFE21780; Sun, 11 Nov 2018 22:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975521; bh=mBlvaBFN0m+RGm2PlBneqZUzF0ew9bQxNLvlrURfLgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AVNGPXDyOCwBy6qzAgYVNxDwE3odDV8mLUk7OI4+eWsiQeoXmPU6JFZH0bTMpXUWL Iukyg5Btu+Zs2PEeZ1hjcf+bSH2TTtA52jDixY6z3YGIre3aJqooCf29xy7wK1/c+2 JM7AYqdnld2mdeAq6HTOlS3guvZknT1ivMS65f7E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 4.14 012/222] parisc: Fix map_pages() to not overwrite existing pte entries Date: Sun, 11 Nov 2018 14:21:49 -0800 Message-Id: <20181111221649.149203301@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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.14-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 @@ -495,12 +495,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);