From: Lei Rao <lei.rao@intel.com>
To: alex.williamson@redhat.com, cohuck@redhat.com,
kevin.tian@intel.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Lei Rao <lei.rao@intel.com>
Subject: [PATCH] vfio: Fix memory leaks in vfio_create_group()
Date: Wed, 29 Jun 2022 10:05:00 +0800 [thread overview]
Message-ID: <20220629020500.878300-1-lei.rao@intel.com> (raw)
If an error occurs after vfio_group_alloc(), we need to release the
group.
Signed-off-by: Lei Rao <lei.rao@intel.com>
---
drivers/vfio/vfio.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 61e71c1154be..2460aec44a6d 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -414,6 +414,7 @@ static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group,
mutex_unlock(&vfio.group_lock);
err_put:
put_device(&group->dev);
+ vfio_group_release(&group->dev);
return ret;
}
--
2.32.0
next reply other threads:[~2022-06-29 2:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 2:05 Lei Rao [this message]
2022-06-29 2:20 ` [PATCH] vfio: Fix memory leaks in vfio_create_group() Tian, Kevin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220629020500.878300-1-lei.rao@intel.com \
--to=lei.rao@intel.com \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.