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

From: Xin Xie

Date: Tue Aug 11 2026 - 09:58:28 EST


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.

--
Xin