Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp16948imu; Thu, 8 Nov 2018 14:00:18 -0800 (PST) X-Google-Smtp-Source: AJdET5fuFLOkPW37HmbokpI+36k0v8VJZTYLEr+AfB9hZabGLnAVeVVDpFJZbJwTUhFU6l4RxVHm X-Received: by 2002:a17:902:b90c:: with SMTP id bf12-v6mr5907982plb.1.1541714418345; Thu, 08 Nov 2018 14:00:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541714418; cv=none; d=google.com; s=arc-20160816; b=SXwyZ9kL9j3PEAvHCKFYgp04QneUqkykDxnlebrnviiP+sBoiy/EcgUkci5KhJG9ML DMmrME3l08B/okLgHfo2sVzknb+FbNH+sB0miLrE+BiRhjhU5o2mR6BQg8rv9vrHw1j7 Ck95bGKXhi5MGdNo5Xc1CMmmlkiro0rPkxIohm2qT8xqm3Ffd0w02IBlYRdR+ylmeYcQ qfuaEO8xpHZfk2z0R472GrCOHi9aVzagtSUoJZQfVET48eKwnA3KpR9O8aPqknTusmJN pMyfMNx+NYwJ/zO+eJI0D/OwnFr9qwkYbmbwmls3N3JYUzrjlUOktCXVswzHVqkmgZst 0Qfg== 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=iEPOaI6U8KnZebe1lrJrkP1MzP8tIJEVk13q073LuY0=; b=LsLfjQTaitAMvbxfwBlai0thA82FUB9vU/YibMX1l/Wwx5Tz+p0i3yjpw6mfJNniKS ns2GZ2zVebZ1Zc5Pxj47G2Ohj7/GI8lxy4ziOIS2t/QqSzV+wqJ527flObv3F+2Auo1R IBzoTwSg69p+EGgy+lLCJg4dt3K/Cj61DNlKKxeAd/9cR6dEdOx/7Wbxj5fdQiLuj5Vr gd7qT5e9Ltw4DfKDuKVhL7ZKNBLB6eRJC89H5Eyg+F9fCSoTWaIOvXEXzDbRMwuUjYbK 1/foLZJsZ5MbYlLFXR5AX39DgSAWbYSqBWz2BUzUm4OuTeyZl6CSuoAWMOdL27dgppOm ZRbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fmlYz0Z4; 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 p187-v6si5208288pfb.127.2018.11.08.14.00.00; Thu, 08 Nov 2018 14:00:18 -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=fmlYz0Z4; 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 S1729789AbeKIHgO (ORCPT + 99 others); Fri, 9 Nov 2018 02:36:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:53458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729771AbeKIHgO (ORCPT ); Fri, 9 Nov 2018 02:36:14 -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 BAF8E20818; Thu, 8 Nov 2018 21:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714325; bh=IgKmV49kmZh5y4setLfe2hcJ1IT5NMpFEZqVk2qWbL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fmlYz0Z4uSA+NkrTI1OVZvDDujqDc1Deb8KsGjesBcZZsDxITwmgi+8czE020yCrc aGWCdxrI2FB9vz0uyhbG92yaIK9KcMiJZzNPprXZK7u/FGtQfFmXogOPdPaUwaxf5x ynyb+f9UGeFgFi4Qn0nWLFsq+7YfRN48HBTRnvBU= 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.4 005/114] ARM: 8799/1: mm: fix pci_ioremap_io() offset check Date: Thu, 8 Nov 2018 13:50:20 -0800 Message-Id: <20181108215059.465900235@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@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.4-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 0c81056c1dd7..2a3feb73de0b 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -460,7 +460,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