[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276C825E2BEEDCB6D33F8D38CBB9@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Wed, 29 Jun 2022 02:20:56 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: "Rao, Lei" <lei.rao@...el.com>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"cohuck@...hat.com" <cohuck@...hat.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] vfio: Fix memory leaks in vfio_create_group()
> From: Rao, Lei <lei.rao@...el.com>
> Sent: Wednesday, June 29, 2022 10:05 AM
>
> If an error occurs after vfio_group_alloc(), we need to release the
> group.
>
> Signed-off-by: Lei Rao <lei.rao@...el.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);
this is called automatically by put_device().
> return ret;
> }
>
> --
> 2.32.0
Powered by blists - more mailing lists