From: Diangang Li io_release_dmabuf() drops the target file before destroying the I/O context. If the final file release runs via delayed_fput_work, it can drop the importer's module reference before the ->unmap() and ->release() callbacks have completed. Release the context first so the target file pins the module throughout teardown. Fixes: 62e4bf5b25d4 ("io_uring/rsrc: add dmabuf backed registered buffers") Assisted-by: LLM Signed-off-by: Diangang Li --- io_uring/dma-buf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/io_uring/dma-buf.c b/io_uring/dma-buf.c index 61825d59e384..255767cdb1ca 100644 --- a/io_uring/dma-buf.c +++ b/io_uring/dma-buf.c @@ -4,8 +4,9 @@ static inline void io_release_dmabuf(void *priv) { struct io_buf_dma *bd = priv; - fput(bd->target_file); + /* the open target file keeps the importer's module loaded */ dma_buf_io_ctx_release(bd->ctx); + fput(bd->target_file); kfree(bd); } -- 2.39.5