
From: Kunkun Jiang <jiangkunkun@huawei.com> virt inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I6FHYK CVE: NA -------------------------------- For security purposes, kvzalloc is used to allocate memory. Because the memory may be allocated by vmalloc. So we replace kfree with kvfree here. Reported-by: Zhaolong Wang <wangzhaolong1@huawei.com> Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com> Reviewed-by: Keqian Zhu <zhukeqian1@huawei.com> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> Signed-off-by: jiaqingtong <jiaqingtong@huawei.com> --- drivers/vfio/vfio_iommu_type1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index fc62430a73dd..88081c22e1c3 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -1214,7 +1214,7 @@ static int vfio_iova_dirty_log_clear(u64 __user *bitmap, int ret = 0; bitmap_size = DIRTY_BITMAP_BYTES(size >> pgshift); - bitmap_buffer = kvmalloc(bitmap_size, GFP_KERNEL); + bitmap_buffer = kvzalloc(bitmap_size, GFP_KERNEL); if (!bitmap_buffer) { ret = -ENOMEM; goto out; @@ -1264,7 +1264,7 @@ static int vfio_iova_dirty_log_clear(u64 __user *bitmap, } out: - kfree(bitmap_buffer); + kvfree(bitmap_buffer); return ret; } -- 2.43.GIT