Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2648429imj; Mon, 11 Feb 2019 06:26:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IZI+VOqGlCp3YZDEKfUJ743qnonBcI5pbca5EfGNU6SHdJCPNp/sIEmwsAzDOYW1N/tXzHh X-Received: by 2002:a17:902:6502:: with SMTP id b2mr37172848plk.44.1549895211718; Mon, 11 Feb 2019 06:26:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895211; cv=none; d=google.com; s=arc-20160816; b=P0Z5EB8admw6+TMiwY2R0TmKa5pmIiHxspA7w5pzga1gT780SHK6HnxZ/ZyyFBz73q e97z96pRLn9pwOFNXGKiexuo11rgP3O7B/33WowcT2rdLQzbBcRFUQj5BME68/Jl//xw 0oovQqtH4prL2WseNvwXZOwBHhvDKcIZ0AkHCHUj6YOFKUb4zcpv3ULUHZi/1VFRpB/c IAC8nI14xwUa2R8/+Yrc0D0uyu074cHn/eDr/efhZJZW7egGgfUjZvMyAW2hjpX6jwWc llZ0++khaOS8gMSM0Ej9ftCDs57o7pl4t0dHGZd9gIwJfy/KUmhtB89wLP0B9SM96KsH YwHQ== 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=yEScKtgDxdAWuRNpMDUMWsmJiigQhF9XQDFgM9fvTAE=; b=z5H3KpusRsVwM9r2WkyGm0Z/tRbCDjPw9lYk/aoR7SsTCzX4rPTtDmoGKwkS247sEX oAt1rVyjeNf9ImN8PkNk8pJMNCst0NEwYp9/7FXt0AR2s7t8iO8sH7vFFmhfmzB9AUe/ uI609yDO3wiJAJmJ0RnkogiBNX08cnZPRCh1CF9U5Hiei7wl7jQXPtxos96qasRTSbH7 qKI1URmKw+p5L6sPSY2VK9zY7VN1gYJkb3ASWRAcScylj8X98o+AYGlianDkiHjFkNkN R7KszQWk1LI9WOq1Z2uHqiJjVBviIkbGeX5QkQITddXGDVqEKTFMeRyb0bSVugW70tgP 9mFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cDAnpXo9; 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 az12si10094511plb.78.2019.02.11.06.26.35; Mon, 11 Feb 2019 06:26:51 -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=cDAnpXo9; 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 S1728767AbfBKOWd (ORCPT + 99 others); Mon, 11 Feb 2019 09:22:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:55322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727389AbfBKOWZ (ORCPT ); Mon, 11 Feb 2019 09:22:25 -0500 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 1CA6020838; Mon, 11 Feb 2019 14:22:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894944; bh=Qn6hyg7jchgSP9EQyg3kGXUYhfGl0tLm+GCvKxyKyh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cDAnpXo9IyOSnCPD5EipbOidnvdrscAfph49W6gkYz2I5WjaMpUKDqez8P4w9Ebf2 y4R70dd3fqw21ubx1NHQpuiRtq65/SfxP6+FFSlTdJsJh38NcBnL0hfxY+bnJMnrGX MPUyUDL1cdBOgY/91gs4C2FO0wmQmF9MaDJjR0uM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anatolij Gustschin , Alan Tull , Sasha Levin Subject: [PATCH 4.20 039/352] fpga: altera-cvp: fix bad IO access on x86_64 Date: Mon, 11 Feb 2019 15:14:26 +0100 Message-Id: <20190211141848.807196746@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 187fade88ca0ff2df9d360ca751d948d73db7095 ] If mapping the CvP BAR fails, we still can configure the FPGA via PCI config space access. In this case the iomap pointer is NULL. On x86_64, passing NULL address to pci_iounmap() generates "Bad IO access at port 0x0" output with stack call trace. Fix it. Signed-off-by: Anatolij Gustschin Acked-by: Alan Tull Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/fpga/altera-cvp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c index 36d79b039c57..35c3aa5792e2 100644 --- a/drivers/fpga/altera-cvp.c +++ b/drivers/fpga/altera-cvp.c @@ -478,7 +478,8 @@ static int altera_cvp_probe(struct pci_dev *pdev, return 0; err_unmap: - pci_iounmap(pdev, conf->map); + if (conf->map) + pci_iounmap(pdev, conf->map); pci_release_region(pdev, CVP_BAR); err_disable: cmd &= ~PCI_COMMAND_MEMORY; @@ -493,7 +494,8 @@ static void altera_cvp_remove(struct pci_dev *pdev) u16 cmd; fpga_mgr_unregister(mgr); - pci_iounmap(pdev, conf->map); + if (conf->map) + pci_iounmap(pdev, conf->map); pci_release_region(pdev, CVP_BAR); pci_read_config_word(pdev, PCI_COMMAND, &cmd); cmd &= ~PCI_COMMAND_MEMORY; -- 2.19.1