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

- From: Xin Xie \<hidden\>
- Date: 2026-08-11 13:56:12 
- List: netdev
- Page: https://ratatoskr.run/netdev/2026/08/17396894
- Thread: https://ratatoskr.run/netdev/2026/08/17386402/t.md

```text
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
```
