[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240315005347.GA8896@breakpoint.cc>
Date: Fri, 15 Mar 2024 01:53:47 +0100
From: Florian Westphal <fw@...len.de>
To: Chenyuan Yang <chenyuan0y@...il.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, horms@...nel.org, anjali.k.kulkarni@...cle.com,
pctammela@...atatu.com, andriy.shevchenko@...ux.intel.com,
dhowells@...hat.com, kuniyu@...zon.com, netdev@...r.kernel.org,
zzjas98@...il.com
Subject: Re: [net/netlink] Question about potential memleak in
netlink_proto_init()
Chenyuan Yang <chenyuan0y@...il.com> wrote:
> Dear Netlink Developers,
>
> We are curious whether the function `netlink_proto_init()` might have a memory leak.
Yes, but
> The function is https://elixir.bootlin.com/linux/v6.8/source/net/netlink/af_netlink.c#L2908
> and the relevant code is
> ```
> static int __init netlink_proto_init(void)
> {
> int i;
> ...
>
> for (i = 0; i < MAX_LINKS; i++) {
> if (rhashtable_init(&nl_table[i].hash,
> &netlink_rhashtable_params) < 0) {
> while (--i > 0)
> rhashtable_destroy(&nl_table[i].hash);
> kfree(nl_table);
> goto panic;
... this calls panic(), kernel will crash intentionally.
Perhaps best patch would be to remove this error handling
and panic straight away, this is pretty much dead code.
Powered by blists - more mailing lists