Skip to content

Commit

Permalink
vfio: platform: reset: calxedaxgmac: fix ioaddr leak
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
  • Loading branch information
Eric Auger authored and Alex Williamson committed Nov 3, 2015
1 parent 705e60b commit daac3bb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit daac3bb

Please sign in to comment.