From: Pavel Begunkov Date: Wed, 19 Feb 2025 10:09:54 +0000 (+0000) Subject: io_uring/zcrx: fix leaks on failed registration X-Git-Tag: v6.15-rc1~124^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95e65f2d0bdef883b09b7044b1435a36819ae38a;p=thirdparty%2Fkernel%2Flinux.git 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: 035af94b39fd ("io_uring/zcrx: grab a net device") Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202502190532.W7NnmyiP-lkp@intel.com/ Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/fbf16279dd73fa4c6df048168728355636ba5f53.1739959771.git.asml.silence@gmail.com Signed-off-by: Jens Axboe --- diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c index a9eaab3fccf21..f2d326e18e670 100644 --- a/io_uring/zcrx.c +++ b/io_uring/zcrx.c @@ -388,8 +388,9 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx, goto err; ifq->dev = ifq->netdev->dev.parent; + ret = -EOPNOTSUPP; if (!ifq->dev) - return -EOPNOTSUPP; + goto err; get_device(ifq->dev); ret = io_zcrx_map_area(ifq, ifq->area);