[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250912150418.129306-1-zilin@seu.edu.cn>
Date: Fri, 12 Sep 2025 15:04:18 +0000
From: Zilin Guan <zilin@....edu.cn>
To: brett.creeley@....com
Cc: jgg@...pe.ca,
yishaih@...dia.com,
shameerali.kolothum.thodi@...wei.com,
kevin.tian@...el.com,
alex.williamson@...hat.com,
kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
jianhao.xu@....edu.cn,
Zilin Guan <zilin@....edu.cn>
Subject: [PATCH] vfio/pds: replace bitmap_free with vfree
host_ack_bmp is allocated with vzalloc but is currently freed via
bitmap_free (which ends up using kfree). This is incorrect as
allocation and deallocation functions should be paired.
Using mismatched alloc/free may lead to undefined behavior, memory leaks,
or system instability.
This patch fixes the mismatch by freeing host_ack_bmp with vfree to
match the vzalloc allocation.
Signed-off-by: Zilin Guan <zilin@....edu.cn>
---
drivers/vfio/pci/pds/dirty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vfio/pci/pds/dirty.c b/drivers/vfio/pci/pds/dirty.c
index c51f5e4c3dd6..481992142f79 100644
--- a/drivers/vfio/pci/pds/dirty.c
+++ b/drivers/vfio/pci/pds/dirty.c
@@ -82,7 +82,7 @@ static int pds_vfio_dirty_alloc_bitmaps(struct pds_vfio_region *region,
host_ack_bmp = vzalloc(bytes);
if (!host_ack_bmp) {
- bitmap_free(host_seq_bmp);
+ vfree(host_seq_bmp);
return -ENOMEM;
}
--
2.34.1
Powered by blists - more mailing lists