Skip to content

Commit 7cac633

Browse files
superman-xptaxboe
authored andcommitted
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: a5c98e9 ("io_uring/zcrx: dmabuf backed zerocopy receive") Signed-off-by: Penglei Jiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent e1d7727 commit 7cac633

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

io_uring/zcrx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ static int io_import_dmabuf(struct io_zcrx_ifq *ifq,
106106
for_each_sgtable_dma_sg(mem->sgt, sg, i)
107107
total_size += sg_dma_len(sg);
108108

109-
if (total_size < off + len)
110-
return -EINVAL;
109+
if (total_size < off + len) {
110+
ret = -EINVAL;
111+
goto err;
112+
}
111113

112114
mem->dmabuf_offset = off;
113115
mem->size = len;

0 commit comments

Comments
 (0)