Re: [PATCH net] net: hsr: free learned nodes on device setup failure

Hangbin Liu <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-kernel
Message-ID <anvQaKjaW9JIDQ0D@fedora>
On Tue, Aug 11, 2026 at 03:56:08PM +0200, Xin Xie wrote:
> On 10/08/2026 03:31, Hangbin Liu wrote:
> > Should we use this fix tag? The proxy_node_db is added in
> > 5055cccfc2d1 ("net: hsr: Provide RedBox support (HSR-SAN)").
> > 
> > Thanks
> > Hangbin
> 
> Thanks for checking. I believe 81ba6afd6e64 is the right tag.
> 
> The demonstrated leak is node_db, and the window that creates it was
> born in 81ba6afd6e64: that commit moved per-device RX handler
> registration into hsr_dev_finalize(), ahead of steps that could still
> fail (the second handler registration, self-node allocation,
> register_netdevice()), while the failure unwind never released nodes
> learned through the already-live handler. Before it, reception used
> the module-global dev_add_pack() handler, which could not reach an
> instance until register_hsr_master() at the successful end of
> finalize, so there was nothing to leak.
> 
> proxy_node_db cannot hold entries on any current finalize error
> exit: it is fed only by interlink-port RX, and the interlink add is
> the last failable step in finalize. On this path, the second
> hsr_del_nodes() call is a harmless no-op on an empty list, keeping
> the unwind symmetric with hsr_dellink().
> 
> Using 5055cccfc2d1 would instead keep the fix away from older stable
> trees, where the node_db leak does exist.

Yes, your explanation is reasonable. I just a little concern about the
stable back port. Maybe add a tag like

  Cc: <[email protected]> # 5055cccfc2d1 ("net: hsr: Provide RedBox support (HSR-SAN)")

Let's wait and see other's opinion.

Thanks
Hangbin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.