Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2453190imd; Fri, 2 Nov 2018 11:39:37 -0700 (PDT) X-Google-Smtp-Source: AJdET5drEUFQjZMYps1KrmhS6VewoeRyTBA/5WtMfdQ83EZdGywMfqP598MkAEmSLB3LlLnMbSkh X-Received: by 2002:a63:5f95:: with SMTP id t143mr12036285pgb.395.1541183977766; Fri, 02 Nov 2018 11:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541183977; cv=none; d=google.com; s=arc-20160816; b=w1Tgqfg7GbRbpTpuWrCnu6mS5nV/Nm6q+lJTVVaBDiFefD8uaBEtAojCKD6Okuws43 6w+MvqWm7czjAhTGKX8K4f/jfEhLxWbtnX7fT1GV31APBjjJEV+ghK9qDWRDPLDn6GlD +ljrjhUKKUoAmrOiZp/sMKNFVEaA4/sm3uF6o+3Ts0cX+SfLVidt5nOSNMszRM/ra9Ns BnxMksXwY3auTayOYoKfX4wODK0iYxqLmAydvg0ITz9/BRvpdjSArfrKszxJALH/qzWv WRu63ggKCBkX7lAV9nuailR1ItONYJSSGJ1C1g6gTG5/bIZOOcpumI8AAZMGJlVN8FaE CqBQ== 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=X2mjGaK8/cSuHBnTAurWpg+vaPPjfp5sT49Ox2fvBfI=; b=BL0JoP9GNJV+14XpwWVjoPHzTlnG0rvkI57nUTf3BP1wNwF57GDSoEugdH7zRcy1o3 LDJgebXkQvU/QfX6Q6lSDR4uUGwbEbPx/pZ5SnU4r07jjwG8r9hLqIr8hZvWHku0SrOy VSENky8FFbHCDAyhh5fbFLVoNraJSyz+SSMyg/yeyQQcpP0HZ0jI75WA/dcTrlzkhAbf bb7x1YgcsDsT+9ob+WM/q1MlvaqFIM93Yw68qnZ01Q4ynLBBb4PnpKZNTR/UCuXFQOvW oqM3ppPVEAG77tIGMhHTEkgHdF/vlkPFUfpgF7VrKt2XeyfcV+0VhA7I9bzwhqQRQ/Jm uqsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2LvLWIwm; 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 d37-v6si24102980plb.167.2018.11.02.11.39.23; Fri, 02 Nov 2018 11:39:37 -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=2LvLWIwm; 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 S1728787AbeKCDqZ (ORCPT + 99 others); Fri, 2 Nov 2018 23:46:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:40134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727556AbeKCDqY (ORCPT ); Fri, 2 Nov 2018 23:46:24 -0400 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 B4A0C2081B; Fri, 2 Nov 2018 18:38:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541183893; bh=J74Ylb0oPOAjYd3nOtYu5ppgtIqpE8z4hnA9oeMHKjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2LvLWIwmZbCRxKYHZVf9mEeUgnuRtaZe0AQyOIsdnf98oQf2A5euACXQGNlaLaheI Y5xx0JIMuXhBFA2JFNizqZtFq+St8sAbAFy8rOymixiW1kpkRV503k4UZb8RzXGLnH F7nxRU6FjBZG4t05+8y6hux9FiuXz/ktJZ2YoHQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Petazzoni , Nicolas Pitre , Russell King , Sasha Levin Subject: [PATCH 4.18 012/150] ARM: 8799/1: mm: fix pci_ioremap_io() offset check Date: Fri, 2 Nov 2018 19:32:54 +0100 Message-Id: <20181102182903.524825010@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 3a58ac65e2d7969bcdf1b6acb70fa4d12a88e53e ] IO_SPACE_LIMIT is the ending address of the PCI IO space, i.e something like 0xfffff (and not 0x100000). Therefore, when offset = 0xf0000 is passed as argument, this function fails even though the offset + SZ_64K fits below the IO_SPACE_LIMIT. This makes the last chunk of 64 KB of the I/O space not usable as it cannot be mapped. This patch fixes that by substracing 1 to offset + SZ_64K, so that we compare the addrss of the last byte of the I/O space against IO_SPACE_LIMIT instead of the address of the first byte of what is after the I/O space. Fixes: c2794437091a4 ("ARM: Add fixed PCI i/o mapping") Signed-off-by: Thomas Petazzoni Acked-by: Nicolas Pitre Signed-off-by: Russell King Signed-off-by: Sasha Levin --- arch/arm/mm/ioremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index fc91205ff46c..5bf9443cfbaa 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -473,7 +473,7 @@ void pci_ioremap_set_mem_type(int mem_type) int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr) { - BUG_ON(offset + SZ_64K > IO_SPACE_LIMIT); + BUG_ON(offset + SZ_64K - 1 > IO_SPACE_LIMIT); return ioremap_page_range(PCI_IO_VIRT_BASE + offset, PCI_IO_VIRT_BASE + offset + SZ_64K, -- 2.17.1