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: Eric Auger X-Patchwork-Id: 7546091 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BB5F39F2F7 for ; Tue, 3 Nov 2015 18:13:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C617520717 for ; Tue, 3 Nov 2015 18:13:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC04B204D6 for ; Tue, 3 Nov 2015 18:13:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755745AbbKCSNI (ORCPT ); Tue, 3 Nov 2015 13:13:08 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:37861 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755853AbbKCSMi (ORCPT ); Tue, 3 Nov 2015 13:12:38 -0500 Received: by wmff134 with SMTP id f134so22049237wmf.0 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=QSh5QqJ4hdMTa7D1OjccETo9cKNO0xsJwCmXlTI4SuqbJ+oMOJc9Z8JcQMBdVsGK18 coaS91ZqhW6TzUyszf1Y05mXH1ODaqHylIft5mBdrKRVkugkFJcV/UQ4Aesz+SEJnk6M Bl7PIdYnmlW4rohOlJaIvV0O2qSgTKT3J5p05uzh4TE2pUvoYn+tCQf1TNRfjerQ8v+/ Q1LZLR2YnMdIOIV38WddEm9GZVNbP/vrAWPZ0o63OmadTx0q/23YqlOtehIaywvf4dtT 31dmjsWRvTDjUZWg8TC78nillEDA2lqf/m/r7RLydKO9WbC8imR7ZhZyfKEiK8AukY7s WpDA== X-Gm-Message-State: ALoCoQmGtuZeDtRVGnvr8jh6hSIlyQ7134HqPwrvnbkIa2VmEv8VZtPBgPmUCGqJ6M5gBeqsHv7l X-Received: by 10.28.93.70 with SMTP id r67mr19954150wmb.16.1446574357334; Tue, 03 Nov 2015 10:12:37 -0800 (PST) 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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; }