[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220915013157.60771-2-liulongfang@huawei.com>
Date: Thu, 15 Sep 2022 09:31:53 +0800
From: Longfang Liu <liulongfang@...wei.com>
To: <alex.williamson@...hat.com>, <jgg@...dia.com>,
<shameerali.kolothum.thodi@...wei.com>
CC: <cohuck@...hat.com>, <linux-kernel@...r.kernel.org>,
<linuxarm@...neuler.org>, <liulongfang@...wei.com>
Subject: [PATCH 1/5] hisi_acc_vfio_pci: Fixes a memory leak bug
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);
+ kfree(migf);
return ERR_PTR(ret);
}
+ stream_open(migf->filp->f_inode, migf->filp);
+ mutex_init(&migf->lock);
+
return migf;
}
--
2.33.0
Powered by blists - more mailing lists