diff mbox series

[v2,4/4] mini-os: fix bug in ballooning on PVH

Message ID 20220619065253.19503-5-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series mini-os: some memory map updates for PVH | expand

Commit Message

Jürgen Groß June 19, 2022, 6:52 a.m. UTC
There is a subtle bug in ballooning code for PVH: in case ballooning
extends above a non-RAM area of the memory map, wrong pages will be
used.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2:
- new patch
---
 balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Samuel Thibault June 20, 2022, 10:45 p.m. UTC | #1
Juergen Gross, le dim. 19 juin 2022 08:52:53 +0200, a ecrit:
> There is a subtle bug in ballooning code for PVH: in case ballooning
> extends above a non-RAM area of the memory map, wrong pages will be
> used.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
> V2:
> - new patch
> ---
>  balloon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/balloon.c b/balloon.c
> index 6ad07644..55be8141 100644
> --- a/balloon.c
> +++ b/balloon.c
> @@ -124,7 +124,7 @@ int balloon_up(unsigned long n_pages)
>      for ( pfn = 0; pfn < rc; pfn++ )
>      {
>          arch_pfn_add(start_pfn + pfn, balloon_frames[pfn]);
> -        free_page(pfn_to_virt(nr_mem_pages + pfn));
> +        free_page(pfn_to_virt(start_pfn + pfn));
>      }
>  
>      nr_mem_pages += rc;
> -- 
> 2.35.3
>
diff mbox series

Patch

diff --git a/balloon.c b/balloon.c
index 6ad07644..55be8141 100644
--- a/balloon.c
+++ b/balloon.c
@@ -124,7 +124,7 @@  int balloon_up(unsigned long n_pages)
     for ( pfn = 0; pfn < rc; pfn++ )
     {
         arch_pfn_add(start_pfn + pfn, balloon_frames[pfn]);
-        free_page(pfn_to_virt(nr_mem_pages + pfn));
+        free_page(pfn_to_virt(start_pfn + pfn));
     }
 
     nr_mem_pages += rc;