From: Sasha Levin Date: Fri, 17 Jul 2020 16:16:18 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v4.4.231~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d14efa88028f539c6920e0ccfc000e048695ebdc;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/net-dsa-bcm_sf2-fix-node-reference-count.patch b/queue-5.4/net-dsa-bcm_sf2-fix-node-reference-count.patch new file mode 100644 index 00000000000..f23b70bc74e --- /dev/null +++ b/queue-5.4/net-dsa-bcm_sf2-fix-node-reference-count.patch @@ -0,0 +1,77 @@ +From e1e7c9e975aa84b029951b306e38f82514921c1a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 17 Jun 2020 20:42:44 -0700 +Subject: net: dsa: bcm_sf2: Fix node reference count + +From: Florian Fainelli + +[ Upstream commit 8dbe4c5d5e40fe140221024f7b16bec9f310bf70 ] + +of_find_node_by_name() will do an of_node_put() on the "from" argument. +With CONFIG_OF_DYNAMIC enabled which checks for device_node reference +counts, we would be getting a warning like this: + +[ 6.347230] refcount_t: increment on 0; use-after-free. +[ 6.352498] WARNING: CPU: 3 PID: 77 at lib/refcount.c:156 +refcount_inc_checked+0x38/0x44 +[ 6.360601] Modules linked in: +[ 6.363661] CPU: 3 PID: 77 Comm: kworker/3:1 Tainted: G W +5.4.46-gb78b3e9956e6 #13 +[ 6.372546] Hardware name: BCM97278SV (DT) +[ 6.376649] Workqueue: events deferred_probe_work_func +[ 6.381796] pstate: 60000005 (nZCv daif -PAN -UAO) +[ 6.386595] pc : refcount_inc_checked+0x38/0x44 +[ 6.391133] lr : refcount_inc_checked+0x38/0x44 +... +[ 6.478791] Call trace: +[ 6.481243] refcount_inc_checked+0x38/0x44 +[ 6.485433] kobject_get+0x3c/0x4c +[ 6.488840] of_node_get+0x24/0x34 +[ 6.492247] of_irq_find_parent+0x3c/0xe0 +[ 6.496263] of_irq_parse_one+0xe4/0x1d0 +[ 6.500191] irq_of_parse_and_map+0x44/0x84 +[ 6.504381] bcm_sf2_sw_probe+0x22c/0x844 +[ 6.508397] platform_drv_probe+0x58/0xa8 +[ 6.512413] really_probe+0x238/0x3fc +[ 6.516081] driver_probe_device+0x11c/0x12c +[ 6.520358] __device_attach_driver+0xa8/0x100 +[ 6.524808] bus_for_each_drv+0xb4/0xd0 +[ 6.528650] __device_attach+0xd0/0x164 +[ 6.532493] device_initial_probe+0x24/0x30 +[ 6.536682] bus_probe_device+0x38/0x98 +[ 6.540524] deferred_probe_work_func+0xa8/0xd4 +[ 6.545061] process_one_work+0x178/0x288 +[ 6.549078] process_scheduled_works+0x44/0x48 +[ 6.553529] worker_thread+0x218/0x270 +[ 6.557285] kthread+0xdc/0xe4 +[ 6.560344] ret_from_fork+0x10/0x18 +[ 6.563925] ---[ end trace 68f65caf69bb152a ]--- + +Fix this by adding a of_node_get() to increment the reference count +prior to the call. + +Fixes: afa3b592953b ("net: dsa: bcm_sf2: Ensure correct sub-node is parsed") +Signed-off-by: Florian Fainelli +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/bcm_sf2.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c +index 9502db66092eb..b16aea0e39992 100644 +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -1116,6 +1116,8 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev) + set_bit(0, priv->cfp.used); + set_bit(0, priv->cfp.unique); + ++ /* Balance of_node_put() done by of_find_node_by_name() */ ++ of_node_get(dn); + ports = of_find_node_by_name(dn, "ports"); + if (ports) { + bcm_sf2_identify_ports(priv, ports); +-- +2.25.1 + diff --git a/queue-5.4/net-ethernet-mvneta-add-back-interface-mode-validati.patch b/queue-5.4/net-ethernet-mvneta-add-back-interface-mode-validati.patch new file mode 100644 index 00000000000..e4e94fca7d0 --- /dev/null +++ b/queue-5.4/net-ethernet-mvneta-add-back-interface-mode-validati.patch @@ -0,0 +1,81 @@ +From ad0afe23f1b576b889cc8824658ea98474bbb157 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jun 2020 09:00:45 +0200 +Subject: net: ethernet: mvneta: Add back interface mode validation + +From: Sascha Hauer + +[ Upstream commit 41c2b6b4f0f807803bb49f65835d136941a70f85 ] + +When writing the serdes configuration register was moved to +mvneta_config_interface() the whole code block was removed from +mvneta_port_power_up() in the assumption that its only purpose was to +write the serdes configuration register. As mentioned by Russell King +its purpose was also to check for valid interface modes early so that +later in the driver we do not have to care for unexpected interface +modes. +Add back the test to let the driver bail out early on unhandled +interface modes. + +Fixes: b4748553f53f ("net: ethernet: mvneta: Fix Serdes configuration for SoCs without comphy") +Signed-off-by: Sascha Hauer +Reviewed-by: Russell King +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/mvneta.c | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c +index d443cd19e8951..ccb2abd18d6c7 100644 +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -4496,10 +4496,18 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp, + } + + /* Power up the port */ +-static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) ++static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) + { + /* MAC Cause register should be cleared */ + mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0); ++ ++ if (phy_mode != PHY_INTERFACE_MODE_QSGMII && ++ phy_mode != PHY_INTERFACE_MODE_SGMII && ++ !phy_interface_mode_is_8023z(phy_mode) && ++ !phy_interface_mode_is_rgmii(phy_mode)) ++ return -EINVAL; ++ ++ return 0; + } + + /* Device initialization routine */ +@@ -4683,7 +4691,11 @@ static int mvneta_probe(struct platform_device *pdev) + if (err < 0) + goto err_netdev; + +- mvneta_port_power_up(pp, phy_mode); ++ err = mvneta_port_power_up(pp, pp->phy_interface); ++ if (err < 0) { ++ dev_err(&pdev->dev, "can't power up port\n"); ++ return err; ++ } + + /* Armada3700 network controller does not support per-cpu + * operation, so only single NAPI should be initialized. +@@ -4836,7 +4848,11 @@ static int mvneta_resume(struct device *device) + } + } + mvneta_defaults_set(pp); +- mvneta_port_power_up(pp, pp->phy_interface); ++ err = mvneta_port_power_up(pp, pp->phy_interface); ++ if (err < 0) { ++ dev_err(device, "can't power up port\n"); ++ return err; ++ } + + netif_device_attach(dev); + +-- +2.25.1 + diff --git a/queue-5.4/net-ethernet-mvneta-do-not-error-out-in-non-serdes-m.patch b/queue-5.4/net-ethernet-mvneta-do-not-error-out-in-non-serdes-m.patch new file mode 100644 index 00000000000..3c9a3b65340 --- /dev/null +++ b/queue-5.4/net-ethernet-mvneta-do-not-error-out-in-non-serdes-m.patch @@ -0,0 +1,44 @@ +From b25e13c74d43d767dd47d8fb5c4c44f03087b99a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jun 2020 09:00:44 +0200 +Subject: net: ethernet: mvneta: Do not error out in non serdes modes + +From: Sascha Hauer + +[ Upstream commit d3d239dcb8aae6d7b10642d292b404e57604f7ea ] + +In mvneta_config_interface() the RGMII modes are catched by the default +case which is an error return. The RGMII modes are valid modes for the +driver, so instead of returning an error add a break statement to return +successfully. + +This avoids this warning for non comphy SoCs which use RGMII, like +SolidRun Clearfog: + +WARNING: CPU: 0 PID: 268 at drivers/net/ethernet/marvell/mvneta.c:3512 mvneta_start_dev+0x220/0x23c + +Fixes: b4748553f53f ("net: ethernet: mvneta: Fix Serdes configuration for SoCs without comphy") +Signed-off-by: Sascha Hauer +Reviewed-by: Russell King +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/mvneta.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c +index ffdb7b113f172..d443cd19e8951 100644 +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -3206,7 +3206,7 @@ static int mvneta_config_interface(struct mvneta_port *pp, + MVNETA_HSGMII_SERDES_PROTO); + break; + default: +- return -EINVAL; ++ break; + } + } + +-- +2.25.1 + diff --git a/queue-5.4/net-macb-call-pm_runtime_put_sync-on-failure-path.patch b/queue-5.4/net-macb-call-pm_runtime_put_sync-on-failure-path.patch new file mode 100644 index 00000000000..ffe3a77dcdc --- /dev/null +++ b/queue-5.4/net-macb-call-pm_runtime_put_sync-on-failure-path.patch @@ -0,0 +1,44 @@ +From 5c79b49e4e39f09fcfa681842924a5e3cc6cd7af Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Jul 2020 11:05:03 -0400 +Subject: net: macb: call pm_runtime_put_sync on failure path + +[ Upstream commit 0eaf228d574bd82a9aed73e3953bfb81721f4227 ] + +Call pm_runtime_put_sync() on failure path of at91ether_open. + +Fixes: e6a41c23df0d ("net: macb: ensure interface is not suspended on at91rm9200") +Signed-off-by: Claudiu Beznea +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/cadence/macb_main.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c +index 01ed4d4296db2..a5c4d4d66df35 100644 +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -3708,7 +3708,7 @@ static int at91ether_open(struct net_device *dev) + + ret = at91ether_start(dev); + if (ret) +- return ret; ++ goto pm_exit; + + /* Enable MAC interrupts */ + macb_writel(lp, IER, MACB_BIT(RCOMP) | +@@ -3725,6 +3725,10 @@ static int at91ether_open(struct net_device *dev) + netif_start_queue(dev); + + return 0; ++ ++pm_exit: ++ pm_runtime_put_sync(&lp->pdev->dev); ++ return ret; + } + + /* Close the interface */ +-- +2.25.1 + diff --git a/queue-5.4/of-of_mdio-correct-loop-scanning-logic.patch b/queue-5.4/of-of_mdio-correct-loop-scanning-logic.patch new file mode 100644 index 00000000000..ad3630c7ed6 --- /dev/null +++ b/queue-5.4/of-of_mdio-correct-loop-scanning-logic.patch @@ -0,0 +1,54 @@ +From 6ed7e33c356acbc781b7e2f30494d246582d9298 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 19 Jun 2020 11:47:46 -0700 +Subject: of: of_mdio: Correct loop scanning logic + +From: Florian Fainelli + +[ Upstream commit 5a8d7f126c97d04d893f5e5be2b286437a0d01b0 ] + +Commit 209c65b61d94 ("drivers/of/of_mdio.c:fix of_mdiobus_register()") +introduced a break of the loop on the premise that a successful +registration should exit the loop. The premise is correct but not to +code, because rc && rc != -ENODEV is just a special error condition, +that means we would exit the loop even with rc == -ENODEV which is +absolutely not correct since this is the error code to indicate to the +MDIO bus layer that scanning should continue. + +Fix this by explicitly checking for rc = 0 as the only valid condition +to break out of the loop. + +Fixes: 209c65b61d94 ("drivers/of/of_mdio.c:fix of_mdiobus_register()") +Reviewed-by: Andrew Lunn +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/of/of_mdio.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c +index c34a6df712adb..26ddb4cc675a9 100644 +--- a/drivers/of/of_mdio.c ++++ b/drivers/of/of_mdio.c +@@ -265,10 +265,15 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) + child, addr); + + if (of_mdiobus_child_is_phy(child)) { ++ /* -ENODEV is the return code that PHYLIB has ++ * standardized on to indicate that bus ++ * scanning should continue. ++ */ + rc = of_mdiobus_register_phy(mdio, child, addr); +- if (rc && rc != -ENODEV) ++ if (!rc) ++ break; ++ if (rc != -ENODEV) + goto unregister; +- break; + } + } + } +-- +2.25.1 + diff --git a/queue-5.4/series b/queue-5.4/series index e0d8656804e..afc634f8fff 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -52,3 +52,9 @@ iio-pressure-zpa2326-handle-pm_runtime_get_sync-failure.patch iio-humidity-hts221-fix-alignment-and-data-leak-issues.patch iio-pressure-ms5611-fix-buffer-element-alignment.patch iio-health-afe4403-fix-timestamp-alignment-and-prevent-data-leak.patch +spi-spi-fsl-dspi-fix-lockup-if-device-is-shutdown-du.patch +net-dsa-bcm_sf2-fix-node-reference-count.patch +of-of_mdio-correct-loop-scanning-logic.patch +net-macb-call-pm_runtime_put_sync-on-failure-path.patch +net-ethernet-mvneta-do-not-error-out-in-non-serdes-m.patch +net-ethernet-mvneta-add-back-interface-mode-validati.patch diff --git a/queue-5.4/spi-spi-fsl-dspi-fix-lockup-if-device-is-shutdown-du.patch b/queue-5.4/spi-spi-fsl-dspi-fix-lockup-if-device-is-shutdown-du.patch new file mode 100644 index 00000000000..6bdb48b7780 --- /dev/null +++ b/queue-5.4/spi-spi-fsl-dspi-fix-lockup-if-device-is-shutdown-du.patch @@ -0,0 +1,60 @@ +From 3088bb50c181d997743faa947f1c594bdae9c918 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 22 Jun 2020 13:05:41 +0200 +Subject: spi: spi-fsl-dspi: Fix lockup if device is shutdown during SPI + transfer + +From: Krzysztof Kozlowski + +[ Upstream commit 3c525b69e8c1a9a6944e976603c7a1a713e728f9 ] + +During shutdown, the driver should unregister the SPI controller +and stop the hardware. Otherwise the dspi_transfer_one_message() could +wait on completion infinitely. + +Additionally, calling spi_unregister_controller() first in device +shutdown reverse-matches the probe function, where SPI controller is +registered at the end. + +Fixes: dc234825997e ("spi: spi-fsl-dspi: Adding shutdown hook") +Reported-by: Vladimir Oltean +Signed-off-by: Krzysztof Kozlowski +Tested-by: Vladimir Oltean +Reviewed-by: Vladimir Oltean +Cc: +Link: https://lore.kernel.org/r/20200622110543.5035-2-krzk@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-fsl-dspi.c | 15 +-------------- + 1 file changed, 1 insertion(+), 14 deletions(-) + +diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c +index 3e0e27731922e..c7560d7d16276 100644 +--- a/drivers/spi/spi-fsl-dspi.c ++++ b/drivers/spi/spi-fsl-dspi.c +@@ -1184,20 +1184,7 @@ static int dspi_remove(struct platform_device *pdev) + + static void dspi_shutdown(struct platform_device *pdev) + { +- struct spi_controller *ctlr = platform_get_drvdata(pdev); +- struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); +- +- /* Disable RX and TX */ +- regmap_update_bits(dspi->regmap, SPI_MCR, +- SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF, +- SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF); +- +- /* Stop Running */ +- regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); +- +- dspi_release_dma(dspi); +- clk_disable_unprepare(dspi->clk); +- spi_unregister_controller(dspi->ctlr); ++ dspi_remove(pdev); + } + + static struct platform_driver fsl_dspi_driver = { +-- +2.25.1 +