Skip to contentSkip to conversation

vfio: Fix free in dma mapping error path

PATCH Applied Alex Williamson 2 participants 2 messages Apr 29, 2011 – May 4, 2011 VFIO driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio: Fix free in dma mapping error path

This is allocated via vmalloc, so needs vfree, not kfree.

---

 drivers/vfio/vfio_dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/vfio/vfio_dma.c +1 -1
index cee1a25..4a488b6 100644
@@ -322,7 +322,7 @@ int vfio_dma_map_common(struct vfio_listener *listener,
 	if (ret != npage) {
 		printk(KERN_ERR "%s: get_user_pages_fast returns %d, not %d\n",
 			__func__, ret, npage);
-		kfree(pages);
+		vfree(pages);
 		ret = -EFAULT;
 		goto out_lock;
 	}
Applied
#1 lore raw
Quoted 13 lines · Alex Williamson

This is allocated via vmalloc, so needs vfree, not kfree.

---

 drivers/vfio/vfio_dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/vfio/vfio_dma.c +0 -0
index cee1a25..4a488b6 100644

drivers/vfio/vfio_dma.c int vfio_dma_map_common(struct vfio_listener *listener, · line 328

Quoted 8 lines
drivers/vfio/vfio_dma.c +1 -1
@@ -322,7 +322,7 @@ int vfio_dma_map_common(struct vfio_listener *listener,
 	if (ret != npage) {
 		printk(KERN_ERR "%s: get_user_pages_fast returns %d, not %d\n",
 			__func__, ret, npage);
-		kfree(pages);
+		vfree(pages);
 		ret = -EFAULT;
 		goto out_lock;
 	}

Applied. Thanks.