From f50ce1362468717539a7dbb24fdc2f0a772f63f4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 26 Feb 2019 16:02:21 +0100 Subject: [PATCH] 4.14-stable patches added patches: net-phylink-avoid-resolving-link-state-too-early.patch --- ...avoid-resolving-link-state-too-early.patch | 70 +++++++++++++++++++ queue-4.14/series | 1 + 2 files changed, 71 insertions(+) create mode 100644 queue-4.14/net-phylink-avoid-resolving-link-state-too-early.patch diff --git a/queue-4.14/net-phylink-avoid-resolving-link-state-too-early.patch b/queue-4.14/net-phylink-avoid-resolving-link-state-too-early.patch new file mode 100644 index 00000000000..57d4ed2e4d0 --- /dev/null +++ b/queue-4.14/net-phylink-avoid-resolving-link-state-too-early.patch @@ -0,0 +1,70 @@ +From 87454b6edc1b0143fdb3d9853285477e95af74a4 Mon Sep 17 00:00:00 2001 +From: Russell King +Date: Mon, 11 Feb 2019 15:04:24 +0000 +Subject: net: phylink: avoid resolving link state too early + +From: Russell King + +commit 87454b6edc1b0143fdb3d9853285477e95af74a4 upstream. + +During testing on Armada 388 platforms, it was found with a certain +module configuration that it was possible to trigger a kernel oops +during the module load process, caused by the phylink resolver being +triggered for a currently disabled interface. + +This problem was introduced by changing the way the SFP registration +works, which now can result in the sfp link down notification being +called during phylink_create(). + +Fixes: b5bfc21af5cb ("net: sfp: do not probe SFP module before we're attached") +Signed-off-by: Russell King +Signed-off-by: David S. Miller +Cc: Sasha Levin +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/phy/phylink.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -487,6 +487,17 @@ static void phylink_run_resolve(struct p + queue_work(system_power_efficient_wq, &pl->resolve); + } + ++static void phylink_run_resolve_and_disable(struct phylink *pl, int bit) ++{ ++ unsigned long state = pl->phylink_disable_state; ++ ++ set_bit(bit, &pl->phylink_disable_state); ++ if (state == 0) { ++ queue_work(system_power_efficient_wq, &pl->resolve); ++ flush_work(&pl->resolve); ++ } ++} ++ + static const struct sfp_upstream_ops sfp_phylink_ops; + + static int phylink_register_sfp(struct phylink *pl, struct device_node *np) +@@ -776,9 +787,7 @@ void phylink_stop(struct phylink *pl) + if (pl->sfp_bus) + sfp_upstream_stop(pl->sfp_bus); + +- set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); +- queue_work(system_power_efficient_wq, &pl->resolve); +- flush_work(&pl->resolve); ++ phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_STOPPED); + } + EXPORT_SYMBOL_GPL(phylink_stop); + +@@ -1433,9 +1442,7 @@ static void phylink_sfp_link_down(void * + + WARN_ON(!lockdep_rtnl_is_held()); + +- set_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state); +- queue_work(system_power_efficient_wq, &pl->resolve); +- flush_work(&pl->resolve); ++ phylink_run_resolve_and_disable(pl, PHYLINK_DISABLE_LINK); + } + + static void phylink_sfp_link_up(void *upstream) diff --git a/queue-4.14/series b/queue-4.14/series index f9c5a9cd435..d067690a70e 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -69,3 +69,4 @@ netfilter-ipv6-don-t-preserve-original-oif-for-loopback-address.patch pinctrl-max77620-use-define-directive-for-max77620_pinconf_param-values.patch phy-tegra-remove-redundant-self-assignment-of-map.patch sched-sysctl-fix-attributes-of-some-extern-declarations.patch +net-phylink-avoid-resolving-link-state-too-early.patch -- 2.47.3