Importers notoriously abused the struct page pointers from the sg_table the DMA-buf exporter provides. This has created numerous problems ranging from crashes over random memory corruption to security issues.
To find such bad importers DMA-buf already has a functionality to wrap the sg_table and set the page pointers to NULL enabled under CONFIG_DMABUF_DEBUG.
Change that to just CONFIG_DEBUG to catch even more importers doing something nasty.
Signed-off-by: Christian König christian.koenig@amd.com --- drivers/dma-buf/dma-buf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 71f37544a5c6..d5dfa82ed2dd 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -857,7 +857,7 @@ static int dma_buf_wrap_sg_table(struct sg_table **sg_table) struct dma_buf_sg_table_wrapper *to; int i, ret;
- if (!IS_ENABLED(CONFIG_DMABUF_DEBUG)) + if (!IS_ENABLED(CONFIG_DEBUG)) return 0;
/* @@ -896,7 +896,7 @@ static void dma_buf_unwrap_sg_table(struct sg_table **sg_table) { struct dma_buf_sg_table_wrapper *copy;
- if (!IS_ENABLED(CONFIG_DMABUF_DEBUG)) + if (!IS_ENABLED(CONFIG_DEBUG)) return;
copy = container_of(*sg_table, typeof(*copy), wrapper);
linaro-mm-sig@lists.linaro.org