Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1261770

[PATCH v6 8/8] vfio: platform: reset: calxedaxgmac: fix ioaddr leak

From Eric Auger <eric.auger@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v6 8/8] vfio: platform: reset: calxedaxgmac: fix ioaddr leak
Date 2015-11-03 19:20 +0100
Message-ID <qqOlA-6kC-9@gated-at.bofh.it> (permalink)
References <qqOlA-6kC-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


In the current code the vfio_platform_region is copied on the stack.
As a consequence the ioaddr address is not iounmapped in the vfio
platform driver (vfio_platform_regions_cleanup). The patch uses the
pointer to the region instead.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
---
 drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c b/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c
index 640f5d8..e3d3d94 100644
--- a/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c
+++ b/drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c
@@ -59,20 +59,20 @@ static inline void xgmac_mac_disable(void __iomem *ioaddr)
 
 int vfio_platform_calxedaxgmac_reset(struct vfio_platform_device *vdev)
 {
-	struct vfio_platform_region reg = vdev->regions[0];
+	struct vfio_platform_region *reg = &vdev->regions[0];
 
-	if (!reg.ioaddr) {
-		reg.ioaddr =
-			ioremap_nocache(reg.addr, reg.size);
-		if (!reg.ioaddr)
+	if (!reg->ioaddr) {
+		reg->ioaddr =
+			ioremap_nocache(reg->addr, reg->size);
+		if (!reg->ioaddr)
 			return -ENOMEM;
 	}
 
 	/* disable IRQ */
-	writel(0, reg.ioaddr + XGMAC_DMA_INTR_ENA);
+	writel(0, reg->ioaddr + XGMAC_DMA_INTR_ENA);
 
 	/* Disable the MAC core */
-	xgmac_mac_disable(reg.ioaddr);
+	xgmac_mac_disable(reg->ioaddr);
 
 	return 0;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 0/8] VFIO platform reset module rework Eric Auger <eric.auger@linaro.org> - 2015-11-03 19:20 +0100
  [PATCH v6 6/8] vfio: platform: use list of registered reset function Eric Auger <eric.auger@linaro.org> - 2015-11-03 19:20 +0100
  [PATCH v6 8/8] vfio: platform: reset: calxedaxgmac: fix ioaddr leak Eric Auger <eric.auger@linaro.org> - 2015-11-03 19:20 +0100
  [PATCH v6 3/8] vfio: platform: introduce module_vfio_reset_handler macro Eric Auger <eric.auger@linaro.org> - 2015-11-03 19:20 +0100
  [PATCH v6 2/8] vfio: platform: add capability to register a reset function Eric Auger <eric.auger@linaro.org> - 2015-11-03 19:20 +0100
  [PATCH v6 7/8] vfio: platform: add dev_info on device reset Eric Auger <eric.auger@linaro.org> - 2015-11-03 19:20 +0100
  [PATCH v6 1/8] vfio: platform: introduce vfio-platform-base module Eric Auger <eric.auger@linaro.org> - 2015-11-03 19:20 +0100
  [PATCH v6 4/8] vfio: platform: reset: calxedaxgmac: add reset function registration Eric Auger <eric.auger@linaro.org> - 2015-11-03 19:20 +0100
  [PATCH v6 5/8] vfio: platform: add compat in vfio_platform_device Eric Auger <eric.auger@linaro.org> - 2015-11-03 19:20 +0100

csiph-web