Re: [PATCH] dma-buf: fix leak of ctx and dmabuf reference in dma_buf_io_ctx_create() WARN path

From: Falconet3

Date: Sun Nov 22 2026 - 05:49:31 EST


Withdrawing this patch. Apologies for the noise.

The WARN_ON_ONCE() path in dma_buf_io_ctx_create() is not reachable with
in-tree code: the only in-tree implementation, nvme_init_io_ctx_locked(),
installs all of dev_ops (map/unmap/release) before it returns 0.

And on the only path where it could ever fire — an importer violating the
contract — freeing ctx directly is not safe: init_dma_buf_io_ctx() has
already attached ctx to the dmabuf and linked it into the importer's
tracking, so kfree() + dma_buf_put() leaves dangling pointers and turns an
unreachable leak into a potential use-after-free. Since dev_ops->release
may itself be one of the missing callbacks, the core has no safe generic
cleanup on that path.


Thanks,
Falconet3




Em domingo, 22 de novembro de 2026 às 00:05, Falconet3 <Falconet3@xxxxxxxxx> escreveu:

> (leak of ctx + dmabuf ref on the WARN_ON_ONCE path, new file in v7.4-rc1, patch attached)