Skip to contentSkip to conversation

io_uring: fix resource leak in io_import_dmabuf()

PATCH Applied Penglei Jiang 2 participants 2 messages Jun 25, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: fix resource leak in io_import_dmabuf()

Replace the return statement with setting ret = -EINVAL and jumping to the err label to ensure resources are released via io_release_dmabuf.

Fixes a5c98e942457 ("io_uring/zcrx: dmabuf backed zerocopy receive")
---
 io_uring/zcrx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
io_uring/zcrx.c +4 -2
index 797247a34cb7..085eeed8cd50 100644
@@ -106,8 +106,10 @@ static int io_import_dmabuf(struct io_zcrx_ifq *ifq,
 	for_each_sgtable_dma_sg(mem->sgt, sg, i)
 		total_size += sg_dma_len(sg);
 
-	if (total_size < off + len)
-		return -EINVAL;
+	if (total_size < off + len) {
+		ret = -EINVAL;
+		goto err;
+	}
 
 	mem->dmabuf_offset = off;
 	mem->size = len;
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 4 lines · Penglei Jiang

Replace the return statement with setting ret = -EINVAL and jumping to the err label to ensure resources are released via io_release_dmabuf.

Applied, thanks!

[1/1] io_uring: fix resource leak in io_import_dmabuf()

      commit: 7cac633a42a7b3c8146eb1db76fb80dc652998de

Best regards,

Signature · 1 line
Jens Axboe