Received: by 10.192.165.156 with SMTP id m28csp537842imm; Fri, 13 Apr 2018 03:40:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx49lG9DeEKTKaZIPFtgnPhoW/2xno5wZ8hYK2HYrHTyhxjJr4jrlBKIc+5XdR8N06Xt60B3T X-Received: by 2002:a17:902:8e8c:: with SMTP id bg12-v6mr4760808plb.295.1523616057404; Fri, 13 Apr 2018 03:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523616057; cv=none; d=google.com; s=arc-20160816; b=v9EldFHeyXa6LzKLY7MlXnHdfC4Va9L8ZPH8zNkdMcogkcq/XVPYlNL4rHr3vPCmWK U06j0wetzOkIhKNXsnzhecZ26e2Q/z8+s2CyuOMId5Xqpa+hOkRSyEm46Gp95C/ktC19 yCXiTfV/B8pU2YqGw9IwFElSvz4Fz8/7UneWCmsNYhmDCRe7djdW8uxW+FceS1NbNAX7 Znc9HqMkvJh/1gO7C2XI77KLweiBnJ0wcGXCNi+nVXpAJigcrK0at9kEit/RZB9AWesE 3HSjfUFtRuqPr4+LWxK2a9VAGzDZ8Z35yw8FqdPiZvijs+l+ud4TgTk7mNY27t5PHBV0 9EeQ== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=fISrzmzQ6nLTLN2ovWtkI157N8HKfEU5Ruaetmcf5aY=; b=OTlvznqQ0L6DOXOo56MPy6pof8G6wtiBzwvBGaMQQNFMh9RTL5uRAPNpiOFjuj+tIj Oeb5yljResFC8Ir5pcXB5roucsG17XYlb4YPgcMjjAayouUANge+3c1Txnwdcigiq1Ck BkvzZOMIfHAdGgB4HZ88wzhertpb+UZgnWCEOT64igEORT9bNENS8GVK8W0CZXeOEn2y udeSJlWN9U4jqzoQH+IMNYHM5n82OU+qT/ldvD26YNuvC8yVumQ+l1G4yGh59mt0Kmbu ulqDtCEpXYvK80rlAWwUlQiQL1/6kBEdsIaQ3yvx4MB/Ex364pJ8lSfyZD8AnYrDnrF7 qywQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k65si3741485pgc.329.2018.04.13.03.40.43; Fri, 13 Apr 2018 03:40:57 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754121AbeDMIzI (ORCPT + 99 others); Fri, 13 Apr 2018 04:55:08 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37340 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754094AbeDMIzF (ORCPT ); Fri, 13 Apr 2018 04:55:05 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 673FC81A88C2; Fri, 13 Apr 2018 08:55:04 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-192.ams2.redhat.com [10.36.116.192]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A40B12026980; Fri, 13 Apr 2018 08:55:02 +0000 (UTC) Subject: Re: [PATCH v3 1/2] vfio: platform: Fix reset module leak in error path To: Geert Uytterhoeven , Baptiste Reynal , Alex Williamson References: <1523438149-16433-1-git-send-email-geert+renesas@glider.be> <1523438149-16433-3-git-send-email-geert+renesas@glider.be> Cc: Philipp Zabel , Rob Herring , Mark Rutland , kvm@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org From: Auger Eric Message-ID: Date: Fri, 13 Apr 2018 10:55:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1523438149-16433-3-git-send-email-geert+renesas@glider.be> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 13 Apr 2018 08:55:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 13 Apr 2018 08:55:04 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eric.auger@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, On 11/04/18 11:15, Geert Uytterhoeven wrote: > If the IOMMU group setup fails, the reset module is not released. > > Fixes: b5add544d677d363 ("vfio, platform: make reset driver a requirement by default") > Signed-off-by: Geert Uytterhoeven > Reviewed-by: Eric Auger > Reviewed-by: Simon Horman Acked-by: Eric Auger Thanks Eric > --- > v3: > - Add Reviewed-by, > > v2: > - Add Reviewed-by. > --- > drivers/vfio/platform/vfio_platform_common.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c > index 35469af87f88678e..b60bb5326668498c 100644 > --- a/drivers/vfio/platform/vfio_platform_common.c > +++ b/drivers/vfio/platform/vfio_platform_common.c > @@ -680,18 +680,23 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev, > group = vfio_iommu_group_get(dev); > if (!group) { > pr_err("VFIO: No IOMMU group for device %s\n", vdev->name); > - return -EINVAL; > + ret = -EINVAL; > + goto put_reset; > } > > ret = vfio_add_group_dev(dev, &vfio_platform_ops, vdev); > - if (ret) { > - vfio_iommu_group_put(group, dev); > - return ret; > - } > + if (ret) > + goto put_iommu; > > mutex_init(&vdev->igate); > > return 0; > + > +put_iommu: > + vfio_iommu_group_put(group, dev); > +put_reset: > + vfio_platform_put_reset(vdev); > + return ret; > } > EXPORT_SYMBOL_GPL(vfio_platform_probe_common); > >