From patchwork Mon Dec 9 13:11:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jon Medhurst (Tixy)" X-Patchwork-Id: 3310951 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 46149C0D4A for ; Mon, 9 Dec 2013 13:12:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3AF9420268 for ; Mon, 9 Dec 2013 13:12:02 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 512B420184 for ; Mon, 9 Dec 2013 13:11:57 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vq0cr-0002sZ-Sl; Mon, 09 Dec 2013 13:11:54 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vq0cp-000576-Ex; Mon, 09 Dec 2013 13:11:51 +0000 Received: from smarthost01d.mail.zen.net.uk ([212.23.1.7]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vq0cm-00055n-4Z for linux-arm-kernel@lists.infradead.org; Mon, 09 Dec 2013 13:11:48 +0000 Received: from [82.69.122.217] (helo=[192.168.2.110]) by smarthost01d.mail.zen.net.uk with esmtpsa (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Vq0cC-000AEA-IG; Mon, 09 Dec 2013 13:11:12 +0000 Message-ID: <1386594672.3380.21.camel@linaro1.home> Subject: [PATCH] ARM: cacheflush: correctly limit range of memory region being flushed From: "Jon Medhurst (Tixy)" To: linux-arm-kernel@lists.infradead.org Date: Mon, 09 Dec 2013 13:11:12 +0000 X-Mailer: Evolution 3.4.4-3 Mime-Version: 1.0 X-Originating-smarthost01d-IP: [82.69.122.217] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131209_081148_262356_1B73D620 X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.2 (-) Cc: Christian Gmeiner , Will Deacon X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The __do_cache_op function operates with a 'chunk' size of one page but fails to limit the size of the final chunk so as to not exceed the specified memory region. Fix this. Cc: Reported-by: Christian Gmeiner Tested-by: Christian Gmeiner Acked-by: Will Deacon Signed-off-by: Jon Medhurst --- I'm reposting this patch for extra visibility, it was discussed in the thread title '[GIT PULL] Cacheflush updates for 3.12', see http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/216265.html This patch is in Russell King's patch system as patch 7917... http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7917/1 arch/arm/kernel/traps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index dbf0923..7940241 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -509,9 +509,10 @@ static inline int __do_cache_op(unsigned long start, unsigned long end) { int ret; - unsigned long chunk = PAGE_SIZE; do { + unsigned long chunk = min(PAGE_SIZE, end - start); + if (signal_pending(current)) { struct thread_info *ti = current_thread_info();