From: Juergen Gross Date: Thu, 5 May 2022 06:35:31 +0000 (+0200) Subject: xen/grant-table: never put a reserved grant on the free list X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=eb3042a4b2a6d47aae1c556c0bad958bcc868e5f;p=people%2Fjgross%2Flinux.git xen/grant-table: never put a reserved grant on the free list Make sure a reserved grant is never put on the free list, as this could cause hard to debug errors. Signed-off-by: Juergen Gross Reviewed-by: Boris Ostrovsky --- V3: - new patch --- diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 6ea31ea26008..1a1aec0a88a1 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -207,6 +207,10 @@ static inline void check_free_callbacks(void) static void put_free_entry(grant_ref_t ref) { unsigned long flags; + + if (unlikely(ref < GNTTAB_NR_RESERVED_ENTRIES)) + return; + spin_lock_irqsave(&gnttab_list_lock, flags); gnttab_entry(ref) = gnttab_free_head; gnttab_free_head = ref;