Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1144214imm; Wed, 1 Aug 2018 10:55:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc3QKhg1XJNqORLcyk9JPgUlJ96H/ru5jH54/vYln0jL75rNW2Fma0SM5mq+m0ibvhFgKp7 X-Received: by 2002:a62:d10d:: with SMTP id z13-v6mr4104923pfg.98.1533146145101; Wed, 01 Aug 2018 10:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533146145; cv=none; d=google.com; s=arc-20160816; b=yI6AyoQ08ljIv11G3NElczq1ILMZ4J8Qy3lPQWwCVCGIC7EmF14PtkixK4mK646Fq6 yv241j8cewvtBgXWQfR/PvhgsNIFEB3Kd7fbs+l7/OK9+IvS9IKWbIGRl2sFsOaneCu7 2On3NuvcDOjTLyllvruDzPqqQp5Yc6k+6qN0y3g7F8kdO908WqJqURnwsYOtY5y40Y4+ MUSwuPNS5A6Ko/LYMNsX8J5e3u73R1HPz/ZPebtuvtXPqxTtOtR9ijriRM604Ci0FNdh +4wSKb44U0pwxDWmji2Sw4XIxX3uBEQVCXwl6kO8STJA4IJ7Y7C0cRDoFLHKrYVSfS6K CpCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=i3o98k7Bs7wxAIdZwTAigU8WdCFnnCp3ussST22TIhw=; b=YovfsIhTwHNpaGRudKzJANVRNUIQEr96zukBwNeSpUBJPIQfOikAcJITPyrn0DywWZ pCW8Z+8I1ZXozEJq8yxSsg1rvdXQhSuNg0fF3/PSRl/WHxYPzRpof2akMie9RCtOOZkP 1nPcEXWmJo38HoS3F5IruwYrwVbc84K03xa7Wkd8jYjo6t71Ce10HKrjBWdRVa+h5trG mdD0dmgdhmDhpMiMwWkHjUE5igAfEFsTu48ksmHju4pvb3F+IroSSPu8/SOY68JZDzM/ GDLsrVlLlYjpfAuC8QZpNDZQElvAaUOd4tgMCC3726IfqIXK2vSY5iUUq7xitA+vDr54 0+tA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16-v6si18023895pgb.39.2018.08.01.10.55.30; Wed, 01 Aug 2018 10:55:45 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405204AbeHATkp (ORCPT + 99 others); Wed, 1 Aug 2018 15:40:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50120 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406009AbeHATIk (ORCPT ); Wed, 1 Aug 2018 15:08:40 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4AC9B13B0; Wed, 1 Aug 2018 17:15:12 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Eric Auger , Simon Horman , Alex Williamson , Sasha Levin Subject: [PATCH 4.14 028/246] vfio: platform: Fix reset module leak in error path Date: Wed, 1 Aug 2018 18:48:58 +0200 Message-Id: <20180801165013.046693884@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Geert Uytterhoeven [ Upstream commit 28a68387888997e8a7fa57940ea5d55f2e16b594 ] 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 Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/vfio/platform/vfio_platform_common.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c @@ -681,18 +681,23 @@ int vfio_platform_probe_common(struct vf 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);