]> git.baikalelectronics.ru Git - kernel.git/commit
wwan: core: remove all netdevs on ops unregistering
authorSergey Ryazanov <ryazanov.s.a@gmail.com>
Mon, 21 Jun 2021 22:50:55 +0000 (01:50 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 22 Jun 2021 17:01:16 +0000 (10:01 -0700)
commitc5c2ddb1d1b6bcf6db774bb848b73f4fe5720a1c
tree1d8869f900cd021e9c8efa84a909e062c18b45a5
parentb9bf0e193841d8f37cb7bd022e481b014c06b3ea
wwan: core: remove all netdevs on ops unregistering

We use the ops owner module hold to protect against ops memory
disappearing. But this approach does not protect us from a driver that
unregisters ops but forgets to remove netdev(s) that were created using
this ops. In such case, we are left with netdev(s), which can not be
removed since ops is gone. Moreover, batch netdevs removing on
deinitialization is a desireable option for WWAN drivers as it is a
quite common task.

Implement deletion of all created links on WWAN netdev ops unregistering
in the same way that RTNL removes all links on RTNL ops unregistering.
Simply remove all child netdevs of a device whose WWAN netdev ops is
unregistering. This way we protecting the kernel from buggy drivers and
make it easier to write a driver deinitialization code.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wwan/wwan_core.c