xen/gntdev: Fix the abuse of underlying struct page in DMA-buf import
authorOleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Sun, 7 Jan 2024 10:34:26 +0000 (12:34 +0200)
committerJuergen Gross <jgross@suse.com>
Wed, 10 Jan 2024 06:32:40 +0000 (07:32 +0100)
commit2d2db7d40254d5fb53b11ebd703cd1ed0c5de7a1
tree5a150a56d66073cc7a291e7e772ae92c6a972353
parentf1479f0a4f53ef4fc12108a59caee61c39bc6843
xen/gntdev: Fix the abuse of underlying struct page in DMA-buf import

DO NOT access the underlying struct page of an sg table exported
by DMA-buf in dmabuf_imp_to_refs(), this is not allowed.
Please see drivers/dma-buf/dma-buf.c:mangle_sg_table() for details.

Fortunately, here (for special Xen device) we can avoid using
pages and calculate gfns directly from dma addresses provided by
the sg table.

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Link: https://lore.kernel.org/r/20240107103426.2038075-1-olekstysh@gmail.com
Signed-off-by: Juergen Gross <jgross@suse.com>
drivers/xen/gntdev-dmabuf.c