diff mbox series

[1/1] io_uring/zcrx: fix leaks on failed registration

Message ID fbf16279dd73fa4c6df048168728355636ba5f53.1739959771.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series [1/1] io_uring/zcrx: fix leaks on failed registration | expand

Commit Message

Pavel Begunkov Feb. 19, 2025, 10:09 a.m. UTC
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: 9fd13751abf5f ("io_uring/zcrx: grab a net device")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202502190532.W7NnmyiP-lkp@intel.com/
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/zcrx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jens Axboe Feb. 19, 2025, 3:07 p.m. UTC | #1
On Wed, 19 Feb 2025 10:09:54 +0000, Pavel Begunkov wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] io_uring/zcrx: fix leaks on failed registration
      commit: f6977b06c598eab1db7416476452cf260208dbb0

Best regards,
diff mbox series

Patch

diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index a9eaab3fccf2..f2d326e18e67 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);