Re: [PATCH net v2] phonet: check register_netdevice_notifier() error in phonet_device_init()

From: Andrew Lunn

Date: Thu Jul 16 2026 - 09:41:39 EST


On Thu, Jul 16, 2026 at 06:15:04PM +0800, Minhong He wrote:
> phonet_device_init() registers a netdevice notifier before calling
> phonet_netlink_register(), but does not check whether notifier
> registration succeeded. On failure, netlink setup still proceeds and
> init may return success without the notifier in place.
>
> Check the notifier registration error and unwind only the resources
> that were already registered (proc entry and pernet), without calling
> unregister_netdevice_notifier() for a notifier that was never
> registered.

It is a good idea to look around, and see if the same sort of bug
appears again. Think about what happens when phonet_netlink_register()
fails.

> Fixes: f8ff60283de2 ("Phonet: network device and address handling")

Does this bother people

https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

Andrew

---
pw-bot: cr