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 <ankqCHe8D9y09aN3@fedora>
On Sat, Aug 08, 2026 at 01:08:14PM +0200, Xin Xie wrote:
> hsr_dev_finalize() can fail after a lower-device RX handler has
> already been registered (slave A is added before the failable slave B
> and interlink adds). RX handlers run in softirq regardless of the
> master's state, so frames received in that window can learn dynamic
> nodes into node_db, and the error unwind never releases them.
> 
> Free both owned dynamic databases in the unwind, mirroring
> hsr_dellink(). proxy_node_db is provably empty on every current error
> exit (only interlink RX feeds it, and the interlink add is the last
> failable step) and is freed for symmetry. The order is safe:
> hsr_del_port() unregisters each RX handler with synchronize_net()
> before hsr_del_nodes() runs, which removes remaining entries with
> list_del_rcu() and defers their release with call_rcu() for readers
> already under RCU.
> 
> Fixes: 81ba6afd6e64 ("net/hsr: Switch from dev_add_pack() to netdev_rx_handler_register()")

Should we use this fix tag? The proxy_node_db is added in
5055cccfc2d1 ("net: hsr: Provide RedBox support (HSR-SAN)").

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.