[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220920103443.72654dd7.alex.williamson@redhat.com>
Date: Tue, 20 Sep 2022 10:34:43 -0600
From: Alex Williamson <alex.williamson@...hat.com>
To: Longfang Liu <liulongfang@...wei.com>
Cc: <jgg@...dia.com>, <shameerali.kolothum.thodi@...wei.com>,
<cohuck@...hat.com>, <linux-kernel@...r.kernel.org>,
<linuxarm@...neuler.org>
Subject: Re: [PATCH 1/5] hisi_acc_vfio_pci: Fixes a memory leak bug
On Thu, 15 Sep 2022 09:31:53 +0800
Longfang Liu <liulongfang@...wei.com> wrote:
> During the stop copy phase of live migration, the driver allocates
> a memory for the migrated data to save the data.
>
> When an exception occurs when the driver reads device data, the driver
> will report an error to qemu and exit the current migration state.
> But this memory is not released, which will lead to a memory
> leak problem.
>
> So we need to add a memory release operation.
>
> Reviewed-by: Shameer Kolothum <shameerali.kolothum.thodi@...wei.com>
> Signed-off-by: Longfang Liu <liulongfang@...wei.com>
> ---
> drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> index ea762e28c1cc..8fd68af2ed5f 100644
> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> @@ -828,15 +828,15 @@ hisi_acc_vf_stop_copy(struct hisi_acc_vf_core_device *hisi_acc_vdev)
> return ERR_PTR(err);
> }
>
> - stream_open(migf->filp->f_inode, migf->filp);
> - mutex_init(&migf->lock);
> -
> ret = vf_qm_state_save(hisi_acc_vdev, migf);
> if (ret) {
> - fput(migf->filp);
Sorry, why did this fput() get removed? Thanks,
Alex
> + kfree(migf);
> return ERR_PTR(ret);
> }
>
> + stream_open(migf->filp->f_inode, migf->filp);
> + mutex_init(&migf->lock);
> +
> return migf;
> }
>
Powered by blists - more mailing lists