• Sergey Ryazanov's avatar
    wwan: core: remove all netdevs on ops unregistering · 2f752380
    Sergey Ryazanov authored
    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: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
    Reviewed-by: default avatarLoic Poulain <loic.poulain@linaro.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2f752380
wwan_core.c 23.5 KB