diff mbox

vfio: Fix free in dma mapping error path

Message ID 20110429220534.10316.63083.stgit@s20.home (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Alex Williamson April 29, 2011, 10:05 p.m. UTC
This is allocated via vmalloc, so needs vfree, not kfree.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

 drivers/vfio/vfio_dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Tom Lyon May 4, 2011, 7:19 p.m. UTC | #1
On Friday, April 29, 2011 03:05:54 pm Alex Williamson wrote:
> This is allocated via vmalloc, so needs vfree, not kfree.
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> 
>  drivers/vfio/vfio_dma.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/vfio/vfio_dma.c b/drivers/vfio/vfio_dma.c
> index cee1a25..4a488b6 100644
> --- a/drivers/vfio/vfio_dma.c
> +++ b/drivers/vfio/vfio_dma.c
> @@ -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.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/vfio/vfio_dma.c b/drivers/vfio/vfio_dma.c
index cee1a25..4a488b6 100644
--- a/drivers/vfio/vfio_dma.c
+++ b/drivers/vfio/vfio_dma.c
@@ -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;
 	}