Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp61223imu; Thu, 8 Nov 2018 14:49:46 -0800 (PST) X-Google-Smtp-Source: AJdET5c/Jj6AFR583JeTMYsqEac+ntDAS3GOkqIfGeZ5TySVogYqqOhgnf5hVvyk/kmV2K6z5YF3 X-Received: by 2002:a62:4b8c:: with SMTP id d12-v6mr6452732pfj.38.1541717386032; Thu, 08 Nov 2018 14:49:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541717386; cv=none; d=google.com; s=arc-20160816; b=RyTAnt4L+fFidGEJ29ulCLSzzFPohMt7d6bqfzBvDj/bTFABjYU+QWRX3SsmmkYOcB 9onB18v5nuW8W7Iyd08vj6/Qn0qZpVIHIFZHeNtjVVckRuS/3Qhwy5w9SPZiTsKM661/ VxCKMQFXMiOBcxU1Q8VoXnuEkYU+lpBHEZWhS/h5dE4t+KwbGHPs9dXBKyez3XhEh02r Wc5PACj5q9SuQgb1u03xI8mOYgigjOtjCiQ7osol4mTtniiKSd2mBl3umOR86d/pWhGC sluhie96TQmuhViBpP7G3h1a04OH0UnyDBPQhlFmHVrGOCF3YibiyUSBMgQwS64ZFEWE ++Iw== 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=a7c0IuFAa70zeJZDFgKQuoLQPD+jom6iPIC2Sm/e37Y=; b=wkrcSENEYdISYt57vquabXp5PeLqLe7qDjxmger8+Fvymwt06RM0rEYURs5agbb8d3 lZgQdnixudkCNdtDIoFmZN9/RospJQCiMM6lHShNLshuYEC8QUVP93Ru1sHtEPpmpNrT a/bEfDIkLbmHdEEtO6X+wAvyG6NQ1dwfcJb889M7QszSe5a1hNUYa4CCAgfetPz3zZUx qm+PZf5Mh0JmIpVAegv5X8IBWD0L/hGv1ruL6ppGQBHOckFRqqy4OWtjA4BXJU3JDtPE +hDLjWcffnNHAr+mlwyFP7stdBJL0pclhCBJLhVJh1yOC4zVNkwatnkik7IriycRcY+x 7uug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gMRFDAPs; 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 t25-v6si5838108pfj.53.2018.11.08.14.49.30; Thu, 08 Nov 2018 14:49:46 -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=gMRFDAPs; 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 S1727818AbeKIHbV (ORCPT + 99 others); Fri, 9 Nov 2018 02:31:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:45908 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727767AbeKIHbU (ORCPT ); Fri, 9 Nov 2018 02:31:20 -0500 Received: from localhost (unknown [208.72.13.198]) (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 1ADEF2086C; Thu, 8 Nov 2018 21:53:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714034; bh=HwmeArcedaKxJAsaNLgj1IU69UNH6nueGWpvhegz/Fg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMRFDAPsFDg9oWG/k1pPfe4BpZ9qkafqBVR2texaw7pgyf0to+jvaNao7G70F/6zo +7G5Eq7ypfTlbha+8fw7l8LYs7QKDffl26ucHmJNsoB2/JeJxuXfpQaj4N5YP+yHN8 J29H0CJZga+PGijEqJHMK3gP0TrYAkm00CQ96060= 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 3.18 023/144] ARM: 8799/1: mm: fix pci_ioremap_io() offset check Date: Thu, 8 Nov 2018 13:49:54 -0800 Message-Id: <20181108215056.474368379@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215054.826084593@linuxfoundation.org> References: <20181108215054.826084593@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 3.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 d1e5ad7ab3bc..1500d3befe02 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -447,7 +447,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