diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2021-02-16 12:16:28 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-02-16 15:05:07 -0800 |
commit | 3af409ca278d4a8d50e91f9f7c4c33b175645cf3 (patch) | |
tree | 10275431dc38144426ef6e6823f027e02b21ce3c /net/sched/act_api.c | |
parent | 396d7f23adf9e8c436dd81a69488b5b6a865acf8 (diff) | |
download | linux-3af409ca278d4a8d50e91f9f7c4c33b175645cf3.tar.bz2 |
net: enetc: fix destroyed phylink dereference during unbind
The following call path suggests that calling unregister_netdev on an
interface that is up will first bring it down.
enetc_pf_remove
-> unregister_netdev
-> unregister_netdevice_queue
-> unregister_netdevice_many
-> dev_close_many
-> __dev_close_many
-> enetc_close
-> enetc_stop
-> phylink_stop
However, enetc first destroys the phylink instance, then calls
unregister_netdev. This is already dissimilar to the setup (and error
path teardown path) from enetc_pf_probe, but more than that, it is buggy
because it is invalid to call phylink_stop after phylink_destroy.
So let's first unregister the netdev (and let the .ndo_stop events
consume themselves), then destroy the phylink instance, then free the
netdev.
Fixes: 71b77a7a27a3 ("enetc: Migrate to PHYLINK and PCS_LYNX")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_api.c')
0 files changed, 0 insertions, 0 deletions