diff mbox

IB/rdmavt: free the userspace memory region with kfree instead of vfree

Message ID 20160909071537.18821-1-colin.king@canonical.com (mailing list archive)
State Accepted
Headers show

Commit Message

Colin King Sept. 9, 2016, 7:15 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The userspace memory region 'mr' is allocated with kzalloc in
__rvt_alloc_mr  however it is incorrectly being freed with vfree in
__rvt_free_mr. Fix this by using kfree to free it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/infiniband/sw/rdmavt/mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky Sept. 12, 2016, 4:52 a.m. UTC | #1
On Fri, Sep 09, 2016 at 08:15:37AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The userspace memory region 'mr' is allocated with kzalloc in
> __rvt_alloc_mr  however it is incorrectly being freed with vfree in
> __rvt_free_mr. Fix this by using kfree to free it.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

> ---
>  drivers/infiniband/sw/rdmavt/mr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c
> index 80c4b6b..46b6497 100644
> --- a/drivers/infiniband/sw/rdmavt/mr.c
> +++ b/drivers/infiniband/sw/rdmavt/mr.c
> @@ -294,7 +294,7 @@ static void __rvt_free_mr(struct rvt_mr *mr)
>  {
>  	rvt_deinit_mregion(&mr->mr);
>  	rvt_free_lkey(&mr->mr);
> -	vfree(mr);
> +	kfree(mr);
>  }
>
>  /**
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dennis Dalessandro Sept. 13, 2016, 12:44 p.m. UTC | #2
On Fri, 2016-09-09 at 08:15 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>

> 

> The userspace memory region 'mr' is allocated with kzalloc in

> __rvt_alloc_mr  however it is incorrectly being freed with vfree in

> __rvt_free_mr. Fix this by using kfree to free it.

> 

> Signed-off-by: Colin Ian King <colin.king@canonical.com>

> ---

>  drivers/infiniband/sw/rdmavt/mr.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/infiniband/sw/rdmavt/mr.c

> b/drivers/infiniband/sw/rdmavt/mr.c

> index 80c4b6b..46b6497 100644

> --- a/drivers/infiniband/sw/rdmavt/mr.c

> +++ b/drivers/infiniband/sw/rdmavt/mr.c

> @@ -294,7 +294,7 @@ static void __rvt_free_mr(struct rvt_mr *mr)

>  {

>  	rvt_deinit_mregion(&mr->mr);

>  	rvt_free_lkey(&mr->mr);

> -	vfree(mr);

> +	kfree(mr);

>  }

>  

>  /**


Thanks!

Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Doug Ledford Sept. 16, 2016, 6:10 p.m. UTC | #3
On 9/9/2016 3:15 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The userspace memory region 'mr' is allocated with kzalloc in
> __rvt_alloc_mr  however it is incorrectly being freed with vfree in
> __rvt_free_mr. Fix this by using kfree to free it.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/infiniband/sw/rdmavt/mr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c
> index 80c4b6b..46b6497 100644
> --- a/drivers/infiniband/sw/rdmavt/mr.c
> +++ b/drivers/infiniband/sw/rdmavt/mr.c
> @@ -294,7 +294,7 @@ static void __rvt_free_mr(struct rvt_mr *mr)
>  {
>  	rvt_deinit_mregion(&mr->mr);
>  	rvt_free_lkey(&mr->mr);
> -	vfree(mr);
> +	kfree(mr);
>  }
>  
>  /**
> 

Thanks, applied.
diff mbox

Patch

diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c
index 80c4b6b..46b6497 100644
--- a/drivers/infiniband/sw/rdmavt/mr.c
+++ b/drivers/infiniband/sw/rdmavt/mr.c
@@ -294,7 +294,7 @@  static void __rvt_free_mr(struct rvt_mr *mr)
 {
 	rvt_deinit_mregion(&mr->mr);
 	rvt_free_lkey(&mr->mr);
-	vfree(mr);
+	kfree(mr);
 }
 
 /**