Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1566019
| From | David Miller <davem@davemloft.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH net] net: dsa: Keep a reference count on ethernet_dev |
| Date | 2017-01-24 18:40 +0100 |
| Message-ID | <t3dex-7da-3@gated-at.bofh.it> (permalink) |
| References | <t27Xz-6NT-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Sat, 21 Jan 2017 09:40:54 -0800
> of_find_net_device_by_node() just returns a reference to a net_device but does
> not increment its reference count, which means that the master network device
> can just vanish under our feet.
>
> Fixes: 83c0afaec7b7 ("net: dsa: Add new binding implementation")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
This is fine, except now this netdev is completely locked into place with
no way to dynamically unload it.
If someone tries to modunload the driver for this ethernet device,
their screen will fill up with warning messages indicating that the
reference taken here in the DSA code is not going away.
You need to implement a netdev notifier that tears down this DSA
instance during an unregister event and releases the ethernet_dev.
Similar to how we handle protocol addresses bound to a netdev, etc.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH net] net: dsa: Keep a reference count on ethernet_dev Florian Fainelli <f.fainelli@gmail.com> - 2017-01-21 18:50 +0100
Re: [PATCH net] net: dsa: Keep a reference count on ethernet_dev David Miller <davem@davemloft.net> - 2017-01-24 18:40 +0100
Re: [PATCH net] net: dsa: Keep a reference count on ethernet_dev Florian Fainelli <f.fainelli@gmail.com> - 2017-01-24 19:00 +0100
Re: [PATCH net] net: dsa: Keep a reference count on ethernet_dev Florian Fainelli <f.fainelli@gmail.com> - 2017-01-24 23:30 +0100
csiph-web