All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma-buf: enable sg_table wrapping on CONFIG_DEBUG
@ 2026-06-09 13:59 Christian König
  2026-06-09 14:10 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Christian König @ 2026-06-09 13:59 UTC (permalink / raw)
  To: airlied, simona, sumit.semwal; +Cc: linux-media, dri-devel, linaro-mm-sig

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);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-09 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09 13:59 [PATCH] dma-buf: enable sg_table wrapping on CONFIG_DEBUG Christian König
2026-06-09 14:10 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.