linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hv: use correct order when freeing monitor_pages
@ 2014-05-27 17:16 Radim Krčmář
  2014-05-28  1:20 ` Amos Kong
  2014-05-28  3:23 ` Jason Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Radim Krčmář @ 2014-05-27 17:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Jason Wang, stable, K. Y. Srinivasan,
	Haiyang Zhang, devel

We try to free two pages when only one has been allocated.
Cleanup path is unlikely, so I haven't found any trace that would fit,
but I hope that free_pages_prepare() does catch it.

Cc: stable@vger.kernel.org
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 Cc'd stable because the worst-case looks hard to debug.
 Btw. the module can't get unloaded after we successfully connect?

 drivers/hv/connection.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 7f10c15..e84f452 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -224,8 +224,8 @@ cleanup:
 		vmbus_connection.int_page = NULL;
 	}
 
-	free_pages((unsigned long)vmbus_connection.monitor_pages[0], 1);
-	free_pages((unsigned long)vmbus_connection.monitor_pages[1], 1);
+	free_pages((unsigned long)vmbus_connection.monitor_pages[0], 0);
+	free_pages((unsigned long)vmbus_connection.monitor_pages[1], 0);
 	vmbus_connection.monitor_pages[0] = NULL;
 	vmbus_connection.monitor_pages[1] = NULL;
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hv: use correct order when freeing monitor_pages
  2014-05-27 17:16 [PATCH] hv: use correct order when freeing monitor_pages Radim Krčmář
@ 2014-05-28  1:20 ` Amos Kong
  2014-05-28  3:23 ` Jason Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Amos Kong @ 2014-05-28  1:20 UTC (permalink / raw)
  To: Radim Krčmář
  Cc: linux-kernel, Greg Kroah-Hartman, Jason Wang, stable,
	K. Y. Srinivasan, Haiyang Zhang, devel

On Tue, May 27, 2014 at 07:16:20PM +0200, Radim Krčmář wrote:
> We try to free two pages when only one has been allocated.
> Cleanup path is unlikely, so I haven't found any trace that would fit,
> but I hope that free_pages_prepare() does catch it.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
>  Cc'd stable because the worst-case looks hard to debug.
>  Btw. the module can't get unloaded after we successfully connect?
> 
>  drivers/hv/connection.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
> index 7f10c15..e84f452 100644
> --- a/drivers/hv/connection.c
> +++ b/drivers/hv/connection.c
> @@ -224,8 +224,8 @@ cleanup:
>  		vmbus_connection.int_page = NULL;
>  	}
>  
> -	free_pages((unsigned long)vmbus_connection.monitor_pages[0], 1);
> -	free_pages((unsigned long)vmbus_connection.monitor_pages[1], 1);
> +	free_pages((unsigned long)vmbus_connection.monitor_pages[0], 0);
> +	free_pages((unsigned long)vmbus_connection.monitor_pages[1], 0);


Allocate order is 0. (2^0 = 1 page)

  vmbus_connection.monitor_pages[0] = (void *)__get_free_pages((GFP_KERNEL|__GFP_ZERO), 0);
  vmbus_connection.monitor_pages[1] = (void *)__get_free_pages((GFP_KERNEL|__GFP_ZERO), 0);

Looks good.

Reviewed-by: Amos Kong <akong@redhat.com>

>  	vmbus_connection.monitor_pages[0] = NULL;
>  	vmbus_connection.monitor_pages[1] = NULL;
>  
> -- 
> 1.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
			Amos.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hv: use correct order when freeing monitor_pages
  2014-05-27 17:16 [PATCH] hv: use correct order when freeing monitor_pages Radim Krčmář
  2014-05-28  1:20 ` Amos Kong
@ 2014-05-28  3:23 ` Jason Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2014-05-28  3:23 UTC (permalink / raw)
  To: Radim Krčmář, linux-kernel
  Cc: Greg Kroah-Hartman, stable, K. Y. Srinivasan, Haiyang Zhang,
	devel

On 05/28/2014 01:16 AM, Radim Krčmář wrote:
> We try to free two pages when only one has been allocated.
> Cleanup path is unlikely, so I haven't found any trace that would fit,
> but I hope that free_pages_prepare() does catch it.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
>  Cc'd stable because the worst-case looks hard to debug.
>  Btw. the module can't get unloaded after we successfully connect?
>
>  drivers/hv/connection.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
> index 7f10c15..e84f452 100644
> --- a/drivers/hv/connection.c
> +++ b/drivers/hv/connection.c
> @@ -224,8 +224,8 @@ cleanup:
>  		vmbus_connection.int_page = NULL;
>  	}
>  
> -	free_pages((unsigned long)vmbus_connection.monitor_pages[0], 1);
> -	free_pages((unsigned long)vmbus_connection.monitor_pages[1], 1);
> +	free_pages((unsigned long)vmbus_connection.monitor_pages[0], 0);
> +	free_pages((unsigned long)vmbus_connection.monitor_pages[1], 0);
>  	vmbus_connection.monitor_pages[0] = NULL;
>  	vmbus_connection.monitor_pages[1] = NULL;
>  

Acked-by: Jason Wang <jasowang@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-28  3:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-27 17:16 [PATCH] hv: use correct order when freeing monitor_pages Radim Krčmář
2014-05-28  1:20 ` Amos Kong
2014-05-28  3:23 ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).