From patchwork Tue Nov 3 18:12:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 55953 Delivered-To: patches@linaro.org Received: by 10.112.61.134 with SMTP id p6csp1979636lbr; Tue, 3 Nov 2015 10:12:47 -0800 (PST) X-Received: by 10.28.51.70 with SMTP id z67mr19758354wmz.25.1446574357522; Tue, 03 Nov 2015 10:12:37 -0800 (PST) Return-Path: Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com. [2a00:1450:400c:c09::233]) by mx.google.com with ESMTPS id r203si29335111wmd.110.2015.11.03.10.12.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2015 10:12:37 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c09::233 as permitted sender) client-ip=2a00:1450:400c:c09::233; Authentication-Results: mx.google.com; spf=pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c09::233 as permitted sender) smtp.mailfrom=eric.auger@linaro.org; dkim=pass header.i=@linaro_org.20150623.gappssmtp.com Received: by wmec75 with SMTP id c75so93710257wme.1 for ; Tue, 03 Nov 2015 10:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hOGHn7nMFXZkOnOxrvcCHRqRs9fvdvwFcoRzYULl/SU=; b=RXvKR1a5i4cGtKWWZIPx3QGm8OTuLftl4MqUNuAFC+Lef0FgGL+3fJJX6iIcJrEAb+ TETC1oEsk6NTjkQ1NGW2vtBxVFOazQuGtcsfEIgpunDniLpmzn54vrQG5KnlWoXTlrIi XRb3fHYr/N3WRpSJtN7HFV/UQOxhhfTPgoonoavlalBhyvuUxc0YutzctqZY79acEpg9 9E5PV1nGhM4lKyOn1byvP1NXIy1q7DQS9z3rpRxPWAtHJsL1YM2vvP2ynVhVWc0ghdth zaNE3XLVAg8ZM0zlusTiBO8CBrAhEpPG07nBquZirninXELhZwZE0qsO0TFW94X6l68e SX+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hOGHn7nMFXZkOnOxrvcCHRqRs9fvdvwFcoRzYULl/SU=; b=YMP313L6X16dD2yuwYocwNLN7zQEIUAmjNrQtjuFNhrqaJalLrq3IPDlR6gkgLTCYC UpJNMVljrL6slGB76S8unvA0RsI/c2IsaQljlDRaW0ZX4lFlUNbdf+l/GijRBFQ9r4q6 jRh4aKsK0tcCbAlYc8gZLZi5nht5UZdSdLReQ0qHs4L6YkB4+agd9n+xMCVkW6vnuExg dOnCcq12zvJFCbckG8OkSlyYaYjlfm31Jz6snVKO8DLl7ElX8cyBLzbnG64Puzr4IU5r S8F1yP3cJpR2e4rljgYGKT2r91qWlWDZLrb9S4VnI7uMeuNHDt0UOXIrL9tmsJm484PF XsQQ== X-Gm-Message-State: ALoCoQnsE4vgyeq6MhJ7NWBtj/UIbSr97xY03nRINt0BhOSbow1yOp26mdQ2BF06v0Tu+Moq51/j X-Received: by 10.28.93.70 with SMTP id r67mr19954150wmb.16.1446574357334; Tue, 03 Nov 2015 10:12:37 -0800 (PST) Return-Path: Received: from new-host-3.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id om1sm28830527wjc.2.2015.11.03.10.12.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Nov 2015 10:12:36 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, alex.williamson@redhat.com, b.reynal@virtualopensystems.com, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: christoffer.dall@linaro.org, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v6 8/8] vfio: platform: reset: calxedaxgmac: fix ioaddr leak Date: Tue, 3 Nov 2015 18:12:19 +0000 Message-Id: <1446574339-1843-9-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446574339-1843-1-git-send-email-eric.auger@linaro.org> References: <1446574339-1843-1-git-send-email-eric.auger@linaro.org> 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 --- drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 1.9.1 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; }