All of lore.kernel.org
 help / color / mirror / Atom feed
From: kovalev@altlinux.org
To: netdev@vger.kernel.org
Cc: edumazet@google.com, davem@davemloft.net, dsahern@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, ebiederm@xmission.com,
	kovalev@altlinux.org
Subject: [PATCH] tcp_metrics: fix possible memory leak in tcp_metrics_init()
Date: Thu, 15 Feb 2024 23:29:49 +0300	[thread overview]
Message-ID: <20240215202949.29879-1-kovalev@altlinux.org> (raw)

From: Vasiliy Kovalev <kovalev@altlinux.org>

Fixes: 6493517eaea9 ("tcp_metrics: panic when tcp_metrics_init fails.")
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
 net/ipv4/tcp_metrics.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index c2a925538542b5..517c7f801dc220 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -1048,6 +1048,8 @@ void __init tcp_metrics_init(void)
 		panic("Could not register tcp_net_metrics_ops\n");
 
 	ret = genl_register_family(&tcp_metrics_nl_family);
-	if (ret < 0)
+	if (ret < 0) {
 		panic("Could not register tcp_metrics generic netlink\n");
+		unregister_pernet_subsys(&tcp_net_metrics_ops);
+	}
 }
-- 
2.33.8


             reply	other threads:[~2024-02-15 20:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 20:29 kovalev [this message]
2024-02-15 20:34 ` [PATCH] tcp_metrics: fix possible memory leak in tcp_metrics_init() Eric Dumazet

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=20240215202949.29879-1-kovalev@altlinux.org \
    --to=kovalev@altlinux.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.