diff options
author | Juergen Gross <jgross@suse.com> | 2022-05-05 08:35:31 +0200 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2022-05-19 14:21:37 +0200 |
commit | 8c9eb0e3731d7140abc77cd80aeeeea8c2ff325e (patch) | |
tree | f23308fbc65d1f87a31a636b3cf01b4815836659 | |
parent | 79c22318f89f3e6cafeabddd5894cad13c7e5957 (diff) | |
download | linux-8c9eb0e3731d7140abc77cd80aeeeea8c2ff325e.tar.bz2 |
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 <jgross@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
-rw-r--r-- | drivers/xen/grant-table.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |