mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] xen/pvcalls: free active map buffer on pvcalls_front_free_map
@ 2022-12-20 14:50 Oleksii Moisieiev
  2022-12-22 23:14 ` Stefano Stabellini
  2023-01-10  8:07 ` Juergen Gross
  0 siblings, 2 replies; 3+ messages in thread
From: Oleksii Moisieiev @ 2022-12-20 14:50 UTC (permalink / raw)
  To: sstabellini
  Cc: Oleksii Moisieiev, Juergen Gross, Oleksandr Tyshchenko,
	xen-devel, linux-kernel

Data buffer for active map is allocated in alloc_active_ring and freed
in free_active_ring function, which is used only for the error
cleanup. pvcalls_front_release is calling pvcalls_front_free_map which
ends foreign access for this buffer, but doesn't free allocated pages.
Call free_active_ring to clean all allocated resources.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
---
 drivers/xen/pvcalls-front.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c
index 1826e8e67125..9b569278788a 100644
--- a/drivers/xen/pvcalls-front.c
+++ b/drivers/xen/pvcalls-front.c
@@ -225,6 +225,8 @@ static irqreturn_t pvcalls_front_event_handler(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static void free_active_ring(struct sock_mapping *map);
+
 static void pvcalls_front_free_map(struct pvcalls_bedata *bedata,
 				   struct sock_mapping *map)
 {
@@ -240,7 +242,7 @@ static void pvcalls_front_free_map(struct pvcalls_bedata *bedata,
 	for (i = 0; i < (1 << PVCALLS_RING_ORDER); i++)
 		gnttab_end_foreign_access(map->active.ring->ref[i], NULL);
 	gnttab_end_foreign_access(map->active.ref, NULL);
-	free_page((unsigned long)map->active.ring);
+	free_active_ring(map);
 
 	kfree(map);
 }
-- 
2.25.1

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

* Re: [PATCH v1] xen/pvcalls: free active map buffer on pvcalls_front_free_map
  2022-12-20 14:50 [PATCH v1] xen/pvcalls: free active map buffer on pvcalls_front_free_map Oleksii Moisieiev
@ 2022-12-22 23:14 ` Stefano Stabellini
  2023-01-10  8:07 ` Juergen Gross
  1 sibling, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2022-12-22 23:14 UTC (permalink / raw)
  To: Oleksii Moisieiev
  Cc: sstabellini, Juergen Gross, Oleksandr Tyshchenko, xen-devel,
	linux-kernel

On Tue, 20 Dec 2022, Oleksii Moisieiev wrote:
> Data buffer for active map is allocated in alloc_active_ring and freed
> in free_active_ring function, which is used only for the error
> cleanup. pvcalls_front_release is calling pvcalls_front_free_map which
> ends foreign access for this buffer, but doesn't free allocated pages.
> Call free_active_ring to clean all allocated resources.
> 
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  drivers/xen/pvcalls-front.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c
> index 1826e8e67125..9b569278788a 100644
> --- a/drivers/xen/pvcalls-front.c
> +++ b/drivers/xen/pvcalls-front.c
> @@ -225,6 +225,8 @@ static irqreturn_t pvcalls_front_event_handler(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> +static void free_active_ring(struct sock_mapping *map);
> +
>  static void pvcalls_front_free_map(struct pvcalls_bedata *bedata,
>  				   struct sock_mapping *map)
>  {
> @@ -240,7 +242,7 @@ static void pvcalls_front_free_map(struct pvcalls_bedata *bedata,
>  	for (i = 0; i < (1 << PVCALLS_RING_ORDER); i++)
>  		gnttab_end_foreign_access(map->active.ring->ref[i], NULL);
>  	gnttab_end_foreign_access(map->active.ref, NULL);
> -	free_page((unsigned long)map->active.ring);
> +	free_active_ring(map);
>  
>  	kfree(map);
>  }
> -- 
> 2.25.1
> 

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

* Re: [PATCH v1] xen/pvcalls: free active map buffer on pvcalls_front_free_map
  2022-12-20 14:50 [PATCH v1] xen/pvcalls: free active map buffer on pvcalls_front_free_map Oleksii Moisieiev
  2022-12-22 23:14 ` Stefano Stabellini
@ 2023-01-10  8:07 ` Juergen Gross
  1 sibling, 0 replies; 3+ messages in thread
From: Juergen Gross @ 2023-01-10  8:07 UTC (permalink / raw)
  To: Oleksii Moisieiev, sstabellini
  Cc: Oleksandr Tyshchenko, xen-devel, linux-kernel


[-- Attachment #1.1.1: Type: text/plain, Size: 515 bytes --]

On 20.12.22 15:50, Oleksii Moisieiev wrote:
> Data buffer for active map is allocated in alloc_active_ring and freed
> in free_active_ring function, which is used only for the error
> cleanup. pvcalls_front_release is calling pvcalls_front_free_map which
> ends foreign access for this buffer, but doesn't free allocated pages.
> Call free_active_ring to clean all allocated resources.
> 
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>

Pushed to xen/tip.git for-linus-6.2


Juergen


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

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

end of thread, other threads:[~2023-01-10  8:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-20 14:50 [PATCH v1] xen/pvcalls: free active map buffer on pvcalls_front_free_map Oleksii Moisieiev
2022-12-22 23:14 ` Stefano Stabellini
2023-01-10  8:07 ` Juergen Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome