public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: [email protected], kernel test robot <[email protected]>,
	Dan Carpenter <[email protected]>
Subject: [PATCH 1/1] io_uring/zcrx: fix leaks on failed registration
Date: Wed, 19 Feb 2025 10:09:54 +0000	[thread overview]
Message-ID: <fbf16279dd73fa4c6df048168728355636ba5f53.1739959771.git.asml.silence@gmail.com> (raw)

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 <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Closes: https://lore.kernel.org/r/[email protected]/
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/zcrx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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);
-- 
2.48.1


             reply	other threads:[~2025-02-19 10:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19 10:09 Pavel Begunkov [this message]
2025-02-19 15:07 ` [PATCH 1/1] io_uring/zcrx: fix leaks on failed registration Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fbf16279dd73fa4c6df048168728355636ba5f53.1739959771.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox