[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.22] xen/gnttab: Properly drop page ref on a GNTTAB_cache_flush error path



commit 7b34f42e5fcd9c91cbd049a9f8e6fc7b5ff4898e
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Nov 11 14:23:30 2026 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Nov 11 14:23:30 2026 +0100

    xen/gnttab: Properly drop page ref on a GNTTAB_cache_flush error path
    
    This patch was XSA-520 in Xen 4.20 and earlier, as it affected security
    supported x86 cases.
    
    In Xen 4.21 and later, the hypercall is only available to ARM.  
Nevertheless,
    there are two identified cases (STATIC_MEM and the xentrace buffers) on ARM
    where system domains own memory, and need this error path.
    
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reported-by: Yehyeong Lee <yhlee@xxxxxxxxxxxxxxxxxx>
    Reported-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
    Reported-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: d543746a48e2b712510d62f20eaa45db4b4fa2b7
    master date: 2026-11-10 18:34:58 +0000
---
 xen/common/grant_table.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 2ad5ef9270..35c87cf506 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -3635,6 +3635,8 @@ static int _cache_flush(gnttab_cache_flush_t *cflush, 
grant_ref_t *cur_ref)
     owner = page_get_owner_and_reference(page);
     if ( !owner || !owner->grant_table )
     {
+        if ( owner )
+            put_page(page);
         rcu_unlock_domain(d);
         return -EPERM;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.22



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.