• Juergen Gross's avatar
    xen/9p: use alloc/free_pages_exact() · 5cadd4bb
    Juergen Gross authored
    Instead of __get_free_pages() and free_pages() use alloc_pages_exact()
    and free_pages_exact(). This is in preparation of a change of
    gnttab_end_foreign_access() which will prohibit use of high-order
    pages.
    
    By using the local variable "order" instead of ring->intf->ring_order
    in the error path of xen_9pfs_front_alloc_dataring() another bug is
    fixed, as the error path can be entered before ring->intf->ring_order
    is being set.
    
    By using alloc_pages_exact() the size in bytes is specified for the
    allocation, which fixes another bug for the case of
    order < (PAGE_SHIFT - XEN_PAGE_SHIFT).
    
    This is part of CVE-2022-23041 / XSA-396.
    Reported-by: default avatarSimon Gaiser <simon@invisiblethingslab.com>
    Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
    Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
    ---
    V4:
    - new patch
    5cadd4bb
trans_xen.c 12.8 KB