Re: [PATCH v2] batman-adv: handle errors in batadv_init()
Sven Eckelmann <[email protected]> Wed, 29 Jul 2026 17:37:47 +0200
| Newsgroups | org.open-mesh.lists.batman,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <178533946744.235865.9920756941934744327.b4-review@b4> |
On Wed, 29 Jul 2026 16:44:35 +0800, Minhong He <[email protected]> wrote: > batadv_init() ignores errors from several initialization helpers, so the > module can load without those registrations in place. > > Check the fallible init steps and unwind prior initialization in reverse > order of acquisition on failure. > > Signed-off-by: Minhong He <[email protected]> Please don't send new versions as reply to the old version. "batadv" would be correct prefix for the batadv.git repo at https://git.open-mesh.org/batadv.git. So something like "[PATCH batadv v2]" > > > diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c > index 73becb0549488..8fe8a2b27a744 100644 > --- a/net/batman-adv/main.c > +++ b/net/batman-adv/main.c > @@ -94,35 +94,63 @@ static int __init batadv_init(void) > [ ... skip 52 lines ... ] > +err_wifi: > destroy_workqueue(batadv_event_workqueue); > batadv_event_workqueue = NULL; > rcu_barrier(); > + batadv_wifi_net_devices_deinit(); > + goto err_iv; No, this is hard to see an will attract the goto raptor. Feel free to move the "ret = batadv_wifi_net_devices_init();" before the "batadv_event_workqueue = create_singlethread_workqueue("bat_events");" to keep the reverse deinit order and only have a single rcu_barrier(). -- Sven Eckelmann <[email protected]>