[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANn89i+TNVtk8UT1+2QeeKHR-b6AQoopdxpcqcbNVOp9+JYSYw@mail.gmail.com>
Date: Thu, 15 Feb 2024 21:34:49 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: kovalev@...linux.org
Cc: netdev@...r.kernel.org, davem@...emloft.net, dsahern@...nel.org,
kuba@...nel.org, pabeni@...hat.com, ebiederm@...ssion.com
Subject: Re: [PATCH] tcp_metrics: fix possible memory leak in tcp_metrics_init()
On Thu, Feb 15, 2024 at 9:29 PM <kovalev@...linux.org> wrote:
>
> From: Vasiliy Kovalev <kovalev@...linux.org>
>
> Fixes: 6493517eaea9 ("tcp_metrics: panic when tcp_metrics_init fails.")
> Signed-off-by: Vasiliy Kovalev <kovalev@...linux.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);
> + }
> }
Well, the whole point of panic() is to crash the host.
We do not expect to recover.
Powered by blists - more mailing lists