Skip to content

Commit 95e65f2

Browse files
isilenceaxboe
authored andcommitted
io_uring/zcrx: fix leaks on failed registration
If we try to register a device-less interface like veth, io_register_zcrx_ifq() will leak struct io_zcrx_ifq with a bunch of resources attached to it. Fix that. Fixes: 035af94 ("io_uring/zcrx: grab a net device") Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/fbf16279dd73fa4c6df048168728355636ba5f53.1739959771.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent bc674a0 commit 95e65f2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

io_uring/zcrx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,9 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
388388
goto err;
389389

390390
ifq->dev = ifq->netdev->dev.parent;
391+
ret = -EOPNOTSUPP;
391392
if (!ifq->dev)
392-
return -EOPNOTSUPP;
393+
goto err;
393394
get_device(ifq->dev);
394395

395396
ret = io_zcrx_map_area(ifq, ifq->area);

0 commit comments

Comments
 (0)