From f44f8f932e0550e9afa4492bdbcd2b7747989cfe Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 6 May 2020 19:48:14 +0200 Subject: [PATCH] 4.4-stable patches added patches: drivers-net-cpsw-don-t-ignore-phy-mode-if-phy-handle-is-used.patch iommu-dma-respect-iommu-aperture-when-allocating.patch mdio-sun4i-oops-in-error-handling-in-probe.patch net-dsa-slave-fix-of-node-leak-and-phy-priority.patch net-ethernet-fs_enet-fix-fixed-link-phydev-leaks.patch net-ethernet-gianfar-fix-fixed-link-phydev-leaks.patch net-ethernet-marvell-mvneta-fix-fixed-link-phydev-leaks.patch net-ethernet-ucc_geth-fix-fixed-link-phydev-leaks.patch net-phy-avoid-polling-phy-with-phy_ignore_interrupts.patch net-phy-bcm7xxx-fix-shadow-mode-2-disabling.patch net-phy-fix-phy_mac_interrupt.patch nfc-nci-memory-leak-in-nci_core_conn_create.patch of_mdio-fix-node-leak-in-of_phy_register_fixed_link-error-path.patch perf-tools-fix-perf-regs-mask-generation.patch phy-micrel-disable-auto-negotiation-on-startup.patch phy-micrel-fix-finding-phy-properties-in-mac-node-for-ksz9031.patch powerpc-book3s-fix-mce-console-messages-for-unrecoverable-mce.patch powerpc-tm-fix-stack-pointer-corruption-in-__tm_recheckpoint.patch sctp-fix-the-transports-round-robin-issue-when-init-is-retransmitted.patch sunrpc-update-rpcbind_maxnetidlen.patch --- ...gnore-phy-mode-if-phy-handle-is-used.patch | 54 +++++++++++ ...spect-iommu-aperture-when-allocating.patch | 70 +++++++++++++++ ...un4i-oops-in-error-handling-in-probe.patch | 42 +++++++++ ...ve-fix-of-node-leak-and-phy-priority.patch | 62 +++++++++++++ ...-fs_enet-fix-fixed-link-phydev-leaks.patch | 51 +++++++++++ ...-gianfar-fix-fixed-link-phydev-leaks.patch | 57 ++++++++++++ ...l-mvneta-fix-fixed-link-phydev-leaks.patch | 49 ++++++++++ ...ucc_geth-fix-fixed-link-phydev-leaks.patch | 77 ++++++++++++++++ ...lling-phy-with-phy_ignore_interrupts.patch | 60 +++++++++++++ ...-bcm7xxx-fix-shadow-mode-2-disabling.patch | 33 +++++++ queue-4.4/net-phy-fix-phy_mac_interrupt.patch | 89 +++++++++++++++++++ ...-memory-leak-in-nci_core_conn_create.patch | 43 +++++++++ ...f_phy_register_fixed_link-error-path.patch | 36 ++++++++ ...-tools-fix-perf-regs-mask-generation.patch | 48 ++++++++++ ...-disable-auto-negotiation-on-startup.patch | 54 +++++++++++ ...y-properties-in-mac-node-for-ksz9031.patch | 45 ++++++++++ ...nsole-messages-for-unrecoverable-mce.patch | 46 ++++++++++ ...nter-corruption-in-__tm_recheckpoint.patch | 82 +++++++++++++++++ ...bin-issue-when-init-is-retransmitted.patch | 74 +++++++++++++++ queue-4.4/series | 20 +++++ .../sunrpc-update-rpcbind_maxnetidlen.patch | 36 ++++++++ 21 files changed, 1128 insertions(+) create mode 100644 queue-4.4/drivers-net-cpsw-don-t-ignore-phy-mode-if-phy-handle-is-used.patch create mode 100644 queue-4.4/iommu-dma-respect-iommu-aperture-when-allocating.patch create mode 100644 queue-4.4/mdio-sun4i-oops-in-error-handling-in-probe.patch create mode 100644 queue-4.4/net-dsa-slave-fix-of-node-leak-and-phy-priority.patch create mode 100644 queue-4.4/net-ethernet-fs_enet-fix-fixed-link-phydev-leaks.patch create mode 100644 queue-4.4/net-ethernet-gianfar-fix-fixed-link-phydev-leaks.patch create mode 100644 queue-4.4/net-ethernet-marvell-mvneta-fix-fixed-link-phydev-leaks.patch create mode 100644 queue-4.4/net-ethernet-ucc_geth-fix-fixed-link-phydev-leaks.patch create mode 100644 queue-4.4/net-phy-avoid-polling-phy-with-phy_ignore_interrupts.patch create mode 100644 queue-4.4/net-phy-bcm7xxx-fix-shadow-mode-2-disabling.patch create mode 100644 queue-4.4/net-phy-fix-phy_mac_interrupt.patch create mode 100644 queue-4.4/nfc-nci-memory-leak-in-nci_core_conn_create.patch create mode 100644 queue-4.4/of_mdio-fix-node-leak-in-of_phy_register_fixed_link-error-path.patch create mode 100644 queue-4.4/perf-tools-fix-perf-regs-mask-generation.patch create mode 100644 queue-4.4/phy-micrel-disable-auto-negotiation-on-startup.patch create mode 100644 queue-4.4/phy-micrel-fix-finding-phy-properties-in-mac-node-for-ksz9031.patch create mode 100644 queue-4.4/powerpc-book3s-fix-mce-console-messages-for-unrecoverable-mce.patch create mode 100644 queue-4.4/powerpc-tm-fix-stack-pointer-corruption-in-__tm_recheckpoint.patch create mode 100644 queue-4.4/sctp-fix-the-transports-round-robin-issue-when-init-is-retransmitted.patch create mode 100644 queue-4.4/sunrpc-update-rpcbind_maxnetidlen.patch diff --git a/queue-4.4/drivers-net-cpsw-don-t-ignore-phy-mode-if-phy-handle-is-used.patch b/queue-4.4/drivers-net-cpsw-don-t-ignore-phy-mode-if-phy-handle-is-used.patch new file mode 100644 index 00000000000..dc2e3e94d77 --- /dev/null +++ b/queue-4.4/drivers-net-cpsw-don-t-ignore-phy-mode-if-phy-handle-is-used.patch @@ -0,0 +1,54 @@ +From ae092b5bded24d5dc7dae0e0aef4669c169ce874 Mon Sep 17 00:00:00 2001 +From: David Rivshin +Date: Wed, 27 Apr 2016 21:38:26 -0400 +Subject: drivers: net: cpsw: don't ignore phy-mode if phy-handle is used + +From: David Rivshin + +commit ae092b5bded24d5dc7dae0e0aef4669c169ce874 upstream. + +The phy-mode emac property was only being processed in the phy_id +or fixed-link cases. However if phy-handle was specified instead, +an error message would complain about the lack of phy_id or +fixed-link, and then jump past the of_get_phy_mode(). This would +result in the PHY mode defaulting to MII, regardless of what the +devicetree specified. + +Fixes: 9e42f715264f ("drivers: net: cpsw: add phy-handle parsing") +Signed-off-by: David Rivshin +Tested-by: Nicolas Chauvet +Tested-by: Andrew Goodbody +Reviewed-by: Mugunthan V N +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/ti/cpsw.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/ti/cpsw.c ++++ b/drivers/net/ethernet/ti/cpsw.c +@@ -2060,7 +2060,11 @@ static int cpsw_probe_dt(struct cpsw_pla + slave_data->phy_node = of_parse_phandle(slave_node, + "phy-handle", 0); + parp = of_get_property(slave_node, "phy_id", &lenp); +- if (of_phy_is_fixed_link(slave_node)) { ++ if (slave_data->phy_node) { ++ dev_dbg(&pdev->dev, ++ "slave[%d] using phy-handle=\"%s\"\n", ++ i, slave_data->phy_node->full_name); ++ } else if (of_phy_is_fixed_link(slave_node)) { + struct device_node *phy_node; + struct phy_device *phy_dev; + +@@ -2097,7 +2101,9 @@ static int cpsw_probe_dt(struct cpsw_pla + PHY_ID_FMT, mdio->name, phyid); + put_device(&mdio->dev); + } else { +- dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i); ++ dev_err(&pdev->dev, ++ "No slave[%d] phy_id, phy-handle, or fixed-link property\n", ++ i); + goto no_phy_slave; + } + slave_data->phy_if = of_get_phy_mode(slave_node); diff --git a/queue-4.4/iommu-dma-respect-iommu-aperture-when-allocating.patch b/queue-4.4/iommu-dma-respect-iommu-aperture-when-allocating.patch new file mode 100644 index 00000000000..b737a020a78 --- /dev/null +++ b/queue-4.4/iommu-dma-respect-iommu-aperture-when-allocating.patch @@ -0,0 +1,70 @@ +From c987ff0d3cb37d7fe1ddaa370811dfd9f73643fa Mon Sep 17 00:00:00 2001 +From: Robin Murphy +Date: Tue, 9 Aug 2016 17:31:35 +0100 +Subject: iommu/dma: Respect IOMMU aperture when allocating + +From: Robin Murphy + +commit c987ff0d3cb37d7fe1ddaa370811dfd9f73643fa upstream. + +Where a device driver has set a 64-bit DMA mask to indicate the absence +of addressing limitations, we still need to ensure that we don't +allocate IOVAs beyond the actual input size of the IOMMU. The reported +aperture is the most reliable way we have of inferring that input +address size, so use that to enforce a hard upper limit where available. + +Fixes: 0db2e5d18f76 ("iommu: Implement common IOMMU ops for DMA mapping") +Signed-off-by: Robin Murphy +Signed-off-by: Joerg Roedel +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iommu/dma-iommu.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--- a/drivers/iommu/dma-iommu.c ++++ b/drivers/iommu/dma-iommu.c +@@ -152,12 +152,15 @@ int dma_direction_to_prot(enum dma_data_ + } + } + +-static struct iova *__alloc_iova(struct iova_domain *iovad, size_t size, ++static struct iova *__alloc_iova(struct iommu_domain *domain, size_t size, + dma_addr_t dma_limit) + { ++ struct iova_domain *iovad = domain->iova_cookie; + unsigned long shift = iova_shift(iovad); + unsigned long length = iova_align(iovad, size) >> shift; + ++ if (domain->geometry.force_aperture) ++ dma_limit = min(dma_limit, domain->geometry.aperture_end); + /* + * Enforce size-alignment to be safe - there could perhaps be an + * attribute to control this per-device, or at least per-domain... +@@ -297,7 +300,7 @@ struct page **iommu_dma_alloc(struct dev + if (!pages) + return NULL; + +- iova = __alloc_iova(iovad, size, dev->coherent_dma_mask); ++ iova = __alloc_iova(domain, size, dev->coherent_dma_mask); + if (!iova) + goto out_free_pages; + +@@ -369,7 +372,7 @@ dma_addr_t iommu_dma_map_page(struct dev + phys_addr_t phys = page_to_phys(page) + offset; + size_t iova_off = iova_offset(iovad, phys); + size_t len = iova_align(iovad, size + iova_off); +- struct iova *iova = __alloc_iova(iovad, len, dma_get_mask(dev)); ++ struct iova *iova = __alloc_iova(domain, len, dma_get_mask(dev)); + + if (!iova) + return DMA_ERROR_CODE; +@@ -483,7 +486,7 @@ int iommu_dma_map_sg(struct device *dev, + prev = s; + } + +- iova = __alloc_iova(iovad, iova_len, dma_get_mask(dev)); ++ iova = __alloc_iova(domain, iova_len, dma_get_mask(dev)); + if (!iova) + goto out_restore_sg; + diff --git a/queue-4.4/mdio-sun4i-oops-in-error-handling-in-probe.patch b/queue-4.4/mdio-sun4i-oops-in-error-handling-in-probe.patch new file mode 100644 index 00000000000..8db652bf7d5 --- /dev/null +++ b/queue-4.4/mdio-sun4i-oops-in-error-handling-in-probe.patch @@ -0,0 +1,42 @@ +From 227f33beab746aeec4ef3305bd17b1d374df09e7 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Mon, 21 Mar 2016 12:02:31 +0300 +Subject: mdio-sun4i: oops in error handling in probe + +From: Dan Carpenter + +commit 227f33beab746aeec4ef3305bd17b1d374df09e7 upstream. + +We could end up dereferencing an error pointer when we call +regulator_disable(). + +Fixes: 4bdcb1dd9feb ('net: Add MDIO bus driver for the Allwinner EMAC') +Signed-off-by: Dan Carpenter +Acked-by: Chen-Yu Tsai +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/phy/mdio-sun4i.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/phy/mdio-sun4i.c ++++ b/drivers/net/phy/mdio-sun4i.c +@@ -134,6 +134,7 @@ static int sun4i_mdio_probe(struct platf + } + + dev_info(&pdev->dev, "no regulator found\n"); ++ data->regulator = NULL; + } else { + ret = regulator_enable(data->regulator); + if (ret) +@@ -149,7 +150,8 @@ static int sun4i_mdio_probe(struct platf + return 0; + + err_out_disable_regulator: +- regulator_disable(data->regulator); ++ if (data->regulator) ++ regulator_disable(data->regulator); + err_out_free_mdiobus: + mdiobus_free(bus); + return ret; diff --git a/queue-4.4/net-dsa-slave-fix-of-node-leak-and-phy-priority.patch b/queue-4.4/net-dsa-slave-fix-of-node-leak-and-phy-priority.patch new file mode 100644 index 00000000000..572b5091b36 --- /dev/null +++ b/queue-4.4/net-dsa-slave-fix-of-node-leak-and-phy-priority.patch @@ -0,0 +1,62 @@ +From 0d8f3c67151faaa80e332c254372dca58fb2a9d4 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 28 Nov 2016 19:24:54 +0100 +Subject: net: dsa: slave: fix of-node leak and phy priority + +From: Johan Hovold + +commit 0d8f3c67151faaa80e332c254372dca58fb2a9d4 upstream. + +Make sure to drop the reference taken by of_parse_phandle() before +returning from dsa_slave_phy_setup(). + +Note that this also modifies the PHY priority so that any fixed-link +node is only parsed when no phy-handle is given, which is in accordance +with the common scheme for this. + +Fixes: 0d8bcdd383b8 ("net: dsa: allow for more complex PHY setups") +Signed-off-by: Johan Hovold +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + net/dsa/slave.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/net/dsa/slave.c ++++ b/net/dsa/slave.c +@@ -1031,7 +1031,7 @@ static int dsa_slave_phy_setup(struct ds + p->phy_interface = mode; + + phy_dn = of_parse_phandle(port_dn, "phy-handle", 0); +- if (of_phy_is_fixed_link(port_dn)) { ++ if (!phy_dn && of_phy_is_fixed_link(port_dn)) { + /* In the case of a fixed PHY, the DT node associated + * to the fixed PHY is the Port DT node + */ +@@ -1041,7 +1041,7 @@ static int dsa_slave_phy_setup(struct ds + return ret; + } + phy_is_fixed = true; +- phy_dn = port_dn; ++ phy_dn = of_node_get(port_dn); + } + + if (ds->drv->get_phy_flags) +@@ -1060,6 +1060,7 @@ static int dsa_slave_phy_setup(struct ds + ret = dsa_slave_phy_connect(p, slave_dev, phy_id); + if (ret) { + netdev_err(slave_dev, "failed to connect to phy%d: %d\n", phy_id, ret); ++ of_node_put(phy_dn); + return ret; + } + } else { +@@ -1068,6 +1069,8 @@ static int dsa_slave_phy_setup(struct ds + phy_flags, + p->phy_interface); + } ++ ++ of_node_put(phy_dn); + } + + if (p->phy && phy_is_fixed) diff --git a/queue-4.4/net-ethernet-fs_enet-fix-fixed-link-phydev-leaks.patch b/queue-4.4/net-ethernet-fs_enet-fix-fixed-link-phydev-leaks.patch new file mode 100644 index 00000000000..71190e9a152 --- /dev/null +++ b/queue-4.4/net-ethernet-fs_enet-fix-fixed-link-phydev-leaks.patch @@ -0,0 +1,51 @@ +From b9755f03728b21c36375a47a6c6366e00b4f2062 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 28 Nov 2016 19:25:01 +0100 +Subject: net: ethernet: fs_enet: fix fixed-link phydev leaks + +From: Johan Hovold + +commit b9755f03728b21c36375a47a6c6366e00b4f2062 upstream. + +Make sure to deregister and free any fixed-link PHY registered using +of_phy_register_fixed_link() on probe errors and on driver unbind. + +Fixes: bb74d9a4a87b ("fs_enet: use the new fixed PHY helpers") +Signed-off-by: Johan Hovold +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c ++++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +@@ -996,7 +996,7 @@ static int fs_enet_probe(struct platform + err = clk_prepare_enable(clk); + if (err) { + ret = err; +- goto out_free_fpi; ++ goto out_deregister_fixed_link; + } + fpi->clk_per = clk; + } +@@ -1078,6 +1078,9 @@ out_put: + of_node_put(fpi->phy_node); + if (fpi->clk_per) + clk_disable_unprepare(fpi->clk_per); ++out_deregister_fixed_link: ++ if (of_phy_is_fixed_link(ofdev->dev.of_node)) ++ of_phy_deregister_fixed_link(ofdev->dev.of_node); + out_free_fpi: + kfree(fpi); + return ret; +@@ -1096,6 +1099,8 @@ static int fs_enet_remove(struct platfor + of_node_put(fep->fpi->phy_node); + if (fep->fpi->clk_per) + clk_disable_unprepare(fep->fpi->clk_per); ++ if (of_phy_is_fixed_link(ofdev->dev.of_node)) ++ of_phy_deregister_fixed_link(ofdev->dev.of_node); + free_netdev(ndev); + return 0; + } diff --git a/queue-4.4/net-ethernet-gianfar-fix-fixed-link-phydev-leaks.patch b/queue-4.4/net-ethernet-gianfar-fix-fixed-link-phydev-leaks.patch new file mode 100644 index 00000000000..af84755cec9 --- /dev/null +++ b/queue-4.4/net-ethernet-gianfar-fix-fixed-link-phydev-leaks.patch @@ -0,0 +1,57 @@ +From 42c70042458d74ce049ce4a2ea7702f344a0dc0b Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 28 Nov 2016 19:25:02 +0100 +Subject: net: ethernet: gianfar: fix fixed-link phydev leaks + +From: Johan Hovold + +commit 42c70042458d74ce049ce4a2ea7702f344a0dc0b upstream. + +Make sure to deregister and free any fixed-link PHY registered using +of_phy_register_fixed_link() on probe errors and on driver unbind. + +Fixes: be40364544bd ("gianfar: use the new fixed PHY helpers") +Signed-off-by: Johan Hovold +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/freescale/gianfar.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/net/ethernet/freescale/gianfar.c ++++ b/drivers/net/ethernet/freescale/gianfar.c +@@ -1313,6 +1313,7 @@ static void gfar_init_addr_hash_table(st + */ + static int gfar_probe(struct platform_device *ofdev) + { ++ struct device_node *np = ofdev->dev.of_node; + struct net_device *dev = NULL; + struct gfar_private *priv = NULL; + int err = 0, i; +@@ -1465,6 +1466,8 @@ static int gfar_probe(struct platform_de + return 0; + + register_fail: ++ if (of_phy_is_fixed_link(np)) ++ of_phy_deregister_fixed_link(np); + unmap_group_regs(priv); + gfar_free_rx_queues(priv); + gfar_free_tx_queues(priv); +@@ -1477,11 +1480,16 @@ register_fail: + static int gfar_remove(struct platform_device *ofdev) + { + struct gfar_private *priv = platform_get_drvdata(ofdev); ++ struct device_node *np = ofdev->dev.of_node; + + of_node_put(priv->phy_node); + of_node_put(priv->tbi_node); + + unregister_netdev(priv->ndev); ++ ++ if (of_phy_is_fixed_link(np)) ++ of_phy_deregister_fixed_link(np); ++ + unmap_group_regs(priv); + gfar_free_rx_queues(priv); + gfar_free_tx_queues(priv); diff --git a/queue-4.4/net-ethernet-marvell-mvneta-fix-fixed-link-phydev-leaks.patch b/queue-4.4/net-ethernet-marvell-mvneta-fix-fixed-link-phydev-leaks.patch new file mode 100644 index 00000000000..27c01f05e73 --- /dev/null +++ b/queue-4.4/net-ethernet-marvell-mvneta-fix-fixed-link-phydev-leaks.patch @@ -0,0 +1,49 @@ +From 5a57a304315c09f9f93b7b7230a5038555e7fcf9 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 28 Nov 2016 19:25:04 +0100 +Subject: net: ethernet: marvell: mvneta: fix fixed-link phydev leaks + +From: Johan Hovold + +commit 5a57a304315c09f9f93b7b7230a5038555e7fcf9 upstream. + +Make sure to deregister and free any fixed-link PHY registered using +of_phy_register_fixed_link() on probe errors and on driver unbind. + +Fixes: 83895bedeee6 ("net: mvneta: add support for fixed links") +Signed-off-by: Johan Hovold +Reviewed-by: Thomas Petazzoni +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/marvell/mvneta.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -3438,6 +3438,8 @@ err_clk: + clk_disable_unprepare(pp->clk); + err_put_phy_node: + of_node_put(phy_node); ++ if (of_phy_is_fixed_link(dn)) ++ of_phy_deregister_fixed_link(dn); + err_free_irq: + irq_dispose_mapping(dev->irq); + err_free_netdev: +@@ -3449,12 +3451,15 @@ err_free_netdev: + static int mvneta_remove(struct platform_device *pdev) + { + struct net_device *dev = platform_get_drvdata(pdev); ++ struct device_node *dn = pdev->dev.of_node; + struct mvneta_port *pp = netdev_priv(dev); + + unregister_netdev(dev); + clk_disable_unprepare(pp->clk); + free_percpu(pp->ports); + free_percpu(pp->stats); ++ if (of_phy_is_fixed_link(dn)) ++ of_phy_deregister_fixed_link(dn); + irq_dispose_mapping(dev->irq); + of_node_put(pp->phy_node); + free_netdev(dev); diff --git a/queue-4.4/net-ethernet-ucc_geth-fix-fixed-link-phydev-leaks.patch b/queue-4.4/net-ethernet-ucc_geth-fix-fixed-link-phydev-leaks.patch new file mode 100644 index 00000000000..4bef2b5a62c --- /dev/null +++ b/queue-4.4/net-ethernet-ucc_geth-fix-fixed-link-phydev-leaks.patch @@ -0,0 +1,77 @@ +From 0807c4ceb8d171a116edc33e34166416876cae5d Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 28 Nov 2016 19:25:03 +0100 +Subject: net: ethernet: ucc_geth: fix fixed-link phydev leaks + +From: Johan Hovold + +commit 0807c4ceb8d171a116edc33e34166416876cae5d upstream. + +Make sure to deregister and free any fixed-link PHY registered using +of_phy_register_fixed_link() on probe errors and on driver unbind. + +Fixes: 87009814cdbb ("ucc_geth: use the new fixed PHY helpers") +Signed-off-by: Johan Hovold +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/freescale/ucc_geth.c | 23 ++++++++++++++++------- + 1 file changed, 16 insertions(+), 7 deletions(-) + +--- a/drivers/net/ethernet/freescale/ucc_geth.c ++++ b/drivers/net/ethernet/freescale/ucc_geth.c +@@ -3870,9 +3870,8 @@ static int ucc_geth_probe(struct platfor + dev = alloc_etherdev(sizeof(*ugeth)); + + if (dev == NULL) { +- of_node_put(ug_info->tbi_node); +- of_node_put(ug_info->phy_node); +- return -ENOMEM; ++ err = -ENOMEM; ++ goto err_deregister_fixed_link; + } + + ugeth = netdev_priv(dev); +@@ -3909,10 +3908,7 @@ static int ucc_geth_probe(struct platfor + if (netif_msg_probe(ugeth)) + pr_err("%s: Cannot register net device, aborting\n", + dev->name); +- free_netdev(dev); +- of_node_put(ug_info->tbi_node); +- of_node_put(ug_info->phy_node); +- return err; ++ goto err_free_netdev; + } + + mac_addr = of_get_mac_address(np); +@@ -3925,16 +3921,29 @@ static int ucc_geth_probe(struct platfor + ugeth->node = np; + + return 0; ++ ++err_free_netdev: ++ free_netdev(dev); ++err_deregister_fixed_link: ++ if (of_phy_is_fixed_link(np)) ++ of_phy_deregister_fixed_link(np); ++ of_node_put(ug_info->tbi_node); ++ of_node_put(ug_info->phy_node); ++ ++ return err; + } + + static int ucc_geth_remove(struct platform_device* ofdev) + { + struct net_device *dev = platform_get_drvdata(ofdev); + struct ucc_geth_private *ugeth = netdev_priv(dev); ++ struct device_node *np = ofdev->dev.of_node; + + unregister_netdev(dev); + free_netdev(dev); + ucc_geth_memclean(ugeth); ++ if (of_phy_is_fixed_link(np)) ++ of_phy_deregister_fixed_link(np); + of_node_put(ugeth->ug_info->tbi_node); + of_node_put(ugeth->ug_info->phy_node); + diff --git a/queue-4.4/net-phy-avoid-polling-phy-with-phy_ignore_interrupts.patch b/queue-4.4/net-phy-avoid-polling-phy-with-phy_ignore_interrupts.patch new file mode 100644 index 00000000000..9a0ae737170 --- /dev/null +++ b/queue-4.4/net-phy-avoid-polling-phy-with-phy_ignore_interrupts.patch @@ -0,0 +1,60 @@ +From d5c3d84657db57bd23ecd58b97f1c99dd42a7b80 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 18 Jan 2016 19:33:06 -0800 +Subject: net: phy: Avoid polling PHY with PHY_IGNORE_INTERRUPTS + +From: Florian Fainelli + +commit d5c3d84657db57bd23ecd58b97f1c99dd42a7b80 upstream. + +Commit 2c7b49212a86 ("phy: fix the use of PHY_IGNORE_INTERRUPT") changed +a hunk in phy_state_machine() in the PHY_RUNNING case which was not +needed. The change essentially makes the PHY library treat PHY devices +with PHY_IGNORE_INTERRUPT to keep polling for the PHY device, even +though the intent is not to do it. + +Fix this by reverting that specific hunk, which makes the PHY state +machine wait for state changes, and stay in the PHY_RUNNING state for as +long as needed. + +Fixes: 2c7b49212a86 ("phy: fix the use of PHY_IGNORE_INTERRUPT") +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/phy/phy.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +--- a/drivers/net/phy/phy.c ++++ b/drivers/net/phy/phy.c +@@ -912,10 +912,10 @@ void phy_state_machine(struct work_struc + phydev->adjust_link(phydev->attached_dev); + break; + case PHY_RUNNING: +- /* Only register a CHANGE if we are polling or ignoring +- * interrupts and link changed since latest checking. ++ /* Only register a CHANGE if we are polling and link changed ++ * since latest checking. + */ +- if (!phy_interrupt_is_valid(phydev)) { ++ if (phydev->irq == PHY_POLL) { + old_link = phydev->link; + err = phy_read_status(phydev); + if (err) +@@ -1015,8 +1015,13 @@ void phy_state_machine(struct work_struc + dev_dbg(&phydev->dev, "PHY state change %s -> %s\n", + phy_state_to_str(old_state), phy_state_to_str(phydev->state)); + +- queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, +- PHY_STATE_TIME * HZ); ++ /* Only re-schedule a PHY state machine change if we are polling the ++ * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving ++ * between states from phy_mac_interrupt() ++ */ ++ if (phydev->irq == PHY_POLL) ++ queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, ++ PHY_STATE_TIME * HZ); + } + + void phy_mac_interrupt(struct phy_device *phydev, int new_link) diff --git a/queue-4.4/net-phy-bcm7xxx-fix-shadow-mode-2-disabling.patch b/queue-4.4/net-phy-bcm7xxx-fix-shadow-mode-2-disabling.patch new file mode 100644 index 00000000000..c0c066779a6 --- /dev/null +++ b/queue-4.4/net-phy-bcm7xxx-fix-shadow-mode-2-disabling.patch @@ -0,0 +1,33 @@ +From 50d899808d33a5b0aa82be23e824119944042689 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Sat, 6 Feb 2016 12:58:48 -0800 +Subject: net: phy: bcm7xxx: Fix shadow mode 2 disabling + +From: Florian Fainelli + +commit 50d899808d33a5b0aa82be23e824119944042689 upstream. + +The clear and set masks in the call to phy_set_clr_bits() called from +bcm7xxx_config_init() are inverted. We need to fix this by swapping the two +arguments, that is, set 0 bits, but clear the shade mode 2 enable bit. + +Fixes: b560a58c45c66 ("net: phy: add Broadcom BCM7xxx internal PHY driver") +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/phy/bcm7xxx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/phy/bcm7xxx.c ++++ b/drivers/net/phy/bcm7xxx.c +@@ -270,7 +270,7 @@ static int bcm7xxx_config_init(struct ph + phy_write(phydev, MII_BCM7XXX_100TX_FALSE_CAR, 0x7555); + + /* reset shadow mode 2 */ +- ret = phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, MII_BCM7XXX_SHD_MODE_2, 0); ++ ret = phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, 0, MII_BCM7XXX_SHD_MODE_2); + if (ret < 0) + return ret; + diff --git a/queue-4.4/net-phy-fix-phy_mac_interrupt.patch b/queue-4.4/net-phy-fix-phy_mac_interrupt.patch new file mode 100644 index 00000000000..b3789df0fcb --- /dev/null +++ b/queue-4.4/net-phy-fix-phy_mac_interrupt.patch @@ -0,0 +1,89 @@ +From deccd16f91f930af8e91ffbbfc839d0ad8da999d Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Mon, 18 Jan 2016 19:33:07 -0800 +Subject: net: phy: Fix phy_mac_interrupt() + +From: Florian Fainelli + +commit deccd16f91f930af8e91ffbbfc839d0ad8da999d upstream. + +Commit 5ea94e7686a3 ("phy: add phy_mac_interrupt()") to use with +PHY_IGNORE_INTERRUPT added a cancel_work_sync() into phy_mac_interrupt() +which is allowed to sleep, whereas phy_mac_interrupt() is expected to be +callable from interrupt context. + +Now that we have fixed how the PHY state machine treats +PHY_IGNORE_INTERRUPT with respect to state changes, we can just set the +new link state, and queue the PHY state machine for execution so it is +going to read the new link state. + +For that to work properly, we need to update phy_change() not to try to +invoke any interrupt callbacks if we have configured the PHY device for +PHY_IGNORE_INTERRUPT, because that PHY device and its driver are not +required to implement those. + +Fixes: 5ea94e7686a3 ("phy: add phy_mac_interrupt() to use with PHY_IGNORE_INTERRUPT") +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/phy/phy.c | 31 ++++++++++++++++++------------- + 1 file changed, 18 insertions(+), 13 deletions(-) + +--- a/drivers/net/phy/phy.c ++++ b/drivers/net/phy/phy.c +@@ -699,25 +699,29 @@ void phy_change(struct work_struct *work + struct phy_device *phydev = + container_of(work, struct phy_device, phy_queue); + +- if (phydev->drv->did_interrupt && +- !phydev->drv->did_interrupt(phydev)) +- goto ignore; ++ if (phy_interrupt_is_valid(phydev)) { ++ if (phydev->drv->did_interrupt && ++ !phydev->drv->did_interrupt(phydev)) ++ goto ignore; + +- if (phy_disable_interrupts(phydev)) +- goto phy_err; ++ if (phy_disable_interrupts(phydev)) ++ goto phy_err; ++ } + + mutex_lock(&phydev->lock); + if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state)) + phydev->state = PHY_CHANGELINK; + mutex_unlock(&phydev->lock); + +- atomic_dec(&phydev->irq_disable); +- enable_irq(phydev->irq); ++ if (phy_interrupt_is_valid(phydev)) { ++ atomic_dec(&phydev->irq_disable); ++ enable_irq(phydev->irq); + +- /* Reenable interrupts */ +- if (PHY_HALTED != phydev->state && +- phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED)) +- goto irq_enable_err; ++ /* Reenable interrupts */ ++ if (PHY_HALTED != phydev->state && ++ phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED)) ++ goto irq_enable_err; ++ } + + /* reschedule state queue work to run as soon as possible */ + cancel_delayed_work_sync(&phydev->state_queue); +@@ -1026,9 +1030,10 @@ void phy_state_machine(struct work_struc + + void phy_mac_interrupt(struct phy_device *phydev, int new_link) + { +- cancel_work_sync(&phydev->phy_queue); + phydev->link = new_link; +- schedule_work(&phydev->phy_queue); ++ ++ /* Trigger a state machine change */ ++ queue_work(system_power_efficient_wq, &phydev->phy_queue); + } + EXPORT_SYMBOL(phy_mac_interrupt); + diff --git a/queue-4.4/nfc-nci-memory-leak-in-nci_core_conn_create.patch b/queue-4.4/nfc-nci-memory-leak-in-nci_core_conn_create.patch new file mode 100644 index 00000000000..40327331d93 --- /dev/null +++ b/queue-4.4/nfc-nci-memory-leak-in-nci_core_conn_create.patch @@ -0,0 +1,43 @@ +From c6dc65d885b98898bf287aaf44e020077b41769f Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 23 Dec 2015 23:45:27 +0100 +Subject: NFC: nci: memory leak in nci_core_conn_create() + +From: Dan Carpenter + +commit c6dc65d885b98898bf287aaf44e020077b41769f upstream. + +I've moved the check for "number_destination_params" forward +a few lines to avoid leaking "cmd". + +Fixes: caa575a86ec1 ('NFC: nci: fix possible crash in nci_core_conn_create') + +Acked-by: Christophe Ricard +Signed-off-by: Dan Carpenter +Signed-off-by: Samuel Ortiz +Signed-off-by: Greg Kroah-Hartman + +--- + net/nfc/nci/core.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/net/nfc/nci/core.c ++++ b/net/nfc/nci/core.c +@@ -610,14 +610,14 @@ int nci_core_conn_create(struct nci_dev + struct nci_core_conn_create_cmd *cmd; + struct core_conn_create_data data; + ++ if (!number_destination_params) ++ return -EINVAL; ++ + data.length = params_len + sizeof(struct nci_core_conn_create_cmd); + cmd = kzalloc(data.length, GFP_KERNEL); + if (!cmd) + return -ENOMEM; + +- if (!number_destination_params) +- return -EINVAL; +- + cmd->destination_type = destination_type; + cmd->number_destination_params = number_destination_params; + memcpy(cmd->params, params, params_len); diff --git a/queue-4.4/of_mdio-fix-node-leak-in-of_phy_register_fixed_link-error-path.patch b/queue-4.4/of_mdio-fix-node-leak-in-of_phy_register_fixed_link-error-path.patch new file mode 100644 index 00000000000..d39dfce2501 --- /dev/null +++ b/queue-4.4/of_mdio-fix-node-leak-in-of_phy_register_fixed_link-error-path.patch @@ -0,0 +1,36 @@ +From 48c1699d5335bc045b50989a06b1c526b17a25ff Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 16 Nov 2016 15:20:36 +0100 +Subject: of_mdio: fix node leak in of_phy_register_fixed_link error path + +From: Johan Hovold + +commit 48c1699d5335bc045b50989a06b1c526b17a25ff upstream. + +Make sure to drop the of_node reference also on failure to parse the +speed property in of_phy_register_fixed_link(). + +Fixes: 3be2a49e5c08 ("of: provide a binding for fixed link PHYs") +Signed-off-by: Johan Hovold +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/of/of_mdio.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/of/of_mdio.c ++++ b/drivers/of/of_mdio.c +@@ -334,8 +334,11 @@ int of_phy_register_fixed_link(struct de + status.link = 1; + status.duplex = of_property_read_bool(fixed_link_node, + "full-duplex"); +- if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) ++ if (of_property_read_u32(fixed_link_node, "speed", ++ &status.speed)) { ++ of_node_put(fixed_link_node); + return -EINVAL; ++ } + status.pause = of_property_read_bool(fixed_link_node, "pause"); + status.asym_pause = of_property_read_bool(fixed_link_node, + "asym-pause"); diff --git a/queue-4.4/perf-tools-fix-perf-regs-mask-generation.patch b/queue-4.4/perf-tools-fix-perf-regs-mask-generation.patch new file mode 100644 index 00000000000..aea533d7cd4 --- /dev/null +++ b/queue-4.4/perf-tools-fix-perf-regs-mask-generation.patch @@ -0,0 +1,48 @@ +From f47822078dece7189cad0a5f472f148e5e916736 Mon Sep 17 00:00:00 2001 +From: "Naveen N. Rao" +Date: Thu, 28 Apr 2016 15:01:10 +0530 +Subject: perf tools: Fix perf regs mask generation + +From: Naveen N. Rao + +commit f47822078dece7189cad0a5f472f148e5e916736 upstream. + +On some architectures (powerpc in particular), the number of registers +exceeds what can be represented in an integer bitmask. Ensure we +generate the proper bitmask on such platforms. + +Fixes: 71ad0f5e4 ("perf tools: Support for DWARF CFI unwinding on post processing") +Signed-off-by: Naveen N. Rao +Acked-by: Arnaldo Carvalho de Melo +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/util/perf_regs.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/tools/perf/util/perf_regs.c ++++ b/tools/perf/util/perf_regs.c +@@ -12,18 +12,18 @@ int perf_reg_value(u64 *valp, struct reg + int i, idx = 0; + u64 mask = regs->mask; + +- if (regs->cache_mask & (1 << id)) ++ if (regs->cache_mask & (1ULL << id)) + goto out; + +- if (!(mask & (1 << id))) ++ if (!(mask & (1ULL << id))) + return -EINVAL; + + for (i = 0; i < id; i++) { +- if (mask & (1 << i)) ++ if (mask & (1ULL << i)) + idx++; + } + +- regs->cache_mask |= (1 << id); ++ regs->cache_mask |= (1ULL << id); + regs->cache_regs[id] = regs->regs[idx]; + + out: diff --git a/queue-4.4/phy-micrel-disable-auto-negotiation-on-startup.patch b/queue-4.4/phy-micrel-disable-auto-negotiation-on-startup.patch new file mode 100644 index 00000000000..54ec17f8feb --- /dev/null +++ b/queue-4.4/phy-micrel-disable-auto-negotiation-on-startup.patch @@ -0,0 +1,54 @@ +From 99f81afc139c6edd14d77a91ee91685a414a1c66 Mon Sep 17 00:00:00 2001 +From: Alexandre Belloni +Date: Fri, 26 Feb 2016 19:18:23 +0100 +Subject: phy: micrel: Disable auto negotiation on startup + +From: Alexandre Belloni + +commit 99f81afc139c6edd14d77a91ee91685a414a1c66 upstream. + +Disable auto negotiation on init to properly detect an already plugged +cable at boot. + +At boot, when the phy is started, it is in the PHY_UP state. +However, if a cable is plugged at boot, because auto negociation is already +enabled at the time we get the first interrupt, the phy is already running. +But the state machine then switches from PHY_UP to PHY_AN and calls +phy_start_aneg(). phy_start_aneg() will not do anything because aneg is +already enabled on the phy. It will then wait for a interrupt before going +further. This interrupt will never happen unless the cable is unplugged and +then replugged. + +It was working properly before 321beec5047a (net: phy: Use interrupts when +available in NOLINK state) because switching to NOLINK meant starting +polling the phy, even if IRQ were enabled. + +Fixes: 321beec5047a (net: phy: Use interrupts when available in NOLINK state) +Signed-off-by: Alexandre Belloni +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/phy/micrel.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/net/phy/micrel.c ++++ b/drivers/net/phy/micrel.c +@@ -285,6 +285,17 @@ static int kszphy_config_init(struct phy + if (priv->led_mode >= 0) + kszphy_setup_led(phydev, type->led_mode_reg, priv->led_mode); + ++ if (phy_interrupt_is_valid(phydev)) { ++ int ctl = phy_read(phydev, MII_BMCR); ++ ++ if (ctl < 0) ++ return ctl; ++ ++ ret = phy_write(phydev, MII_BMCR, ctl & ~BMCR_ANENABLE); ++ if (ret < 0) ++ return ret; ++ } ++ + return 0; + } + diff --git a/queue-4.4/phy-micrel-fix-finding-phy-properties-in-mac-node-for-ksz9031.patch b/queue-4.4/phy-micrel-fix-finding-phy-properties-in-mac-node-for-ksz9031.patch new file mode 100644 index 00000000000..e6693177a79 --- /dev/null +++ b/queue-4.4/phy-micrel-fix-finding-phy-properties-in-mac-node-for-ksz9031.patch @@ -0,0 +1,45 @@ +From b4c19f71252e3b6b8c6478fd712c592f00b11438 Mon Sep 17 00:00:00 2001 +From: Roosen Henri +Date: Thu, 7 Jan 2016 09:31:15 +0100 +Subject: phy: micrel: Fix finding PHY properties in MAC node for KSZ9031. + +From: Roosen Henri + +commit b4c19f71252e3b6b8c6478fd712c592f00b11438 upstream. + +Commit 651df2183543 ("phy: micrel: Fix finding PHY properties in MAC + node.") only fixes finding PHY properties in MAC node for KSZ9021. This +commit applies the same fix for KSZ9031. + +Fixes: 8b63ec1837fa ("phylib: Make PHYs children of their MDIO bus, not the bus' parent.") +Acked-by: Andrew Lunn +Signed-off-by: Henri Roosen +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/phy/micrel.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/drivers/net/phy/micrel.c ++++ b/drivers/net/phy/micrel.c +@@ -482,9 +482,17 @@ static int ksz9031_config_init(struct ph + "txd2-skew-ps", "txd3-skew-ps" + }; + static const char *control_skews[2] = {"txen-skew-ps", "rxdv-skew-ps"}; ++ const struct device *dev_walker; + +- if (!of_node && dev->parent->of_node) +- of_node = dev->parent->of_node; ++ /* The Micrel driver has a deprecated option to place phy OF ++ * properties in the MAC node. Walk up the tree of devices to ++ * find a device with an OF node. ++ */ ++ dev_walker = &phydev->dev; ++ do { ++ of_node = dev_walker->of_node; ++ dev_walker = dev_walker->parent; ++ } while (!of_node && dev_walker); + + if (of_node) { + ksz9031_of_load_skew_values(phydev, of_node, diff --git a/queue-4.4/powerpc-book3s-fix-mce-console-messages-for-unrecoverable-mce.patch b/queue-4.4/powerpc-book3s-fix-mce-console-messages-for-unrecoverable-mce.patch new file mode 100644 index 00000000000..04c66c5cc60 --- /dev/null +++ b/queue-4.4/powerpc-book3s-fix-mce-console-messages-for-unrecoverable-mce.patch @@ -0,0 +1,46 @@ +From c74dd88e77d3ecbc9e55c78796d82c9aa21cabad Mon Sep 17 00:00:00 2001 +From: Mahesh Salgaonkar +Date: Tue, 9 Aug 2016 10:39:13 +0530 +Subject: powerpc/book3s: Fix MCE console messages for unrecoverable MCE. + +From: Mahesh Salgaonkar + +commit c74dd88e77d3ecbc9e55c78796d82c9aa21cabad upstream. + +When machine check occurs with MSR(RI=0), it means MC interrupt is +unrecoverable and kernel goes down to panic path. But the console +message still shows it as recovered. This patch fixes the MCE console +messages. + +Fixes: 36df96f8acaf ("powerpc/book3s: Decode and save machine check event.") +Signed-off-by: Mahesh Salgaonkar +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/kernel/mce.c | 3 ++- + arch/powerpc/platforms/powernv/opal.c | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +--- a/arch/powerpc/kernel/mce.c ++++ b/arch/powerpc/kernel/mce.c +@@ -92,7 +92,8 @@ void save_mce_event(struct pt_regs *regs + mce->in_use = 1; + + mce->initiator = MCE_INITIATOR_CPU; +- if (handled) ++ /* Mark it recovered if we have handled it and MSR(RI=1). */ ++ if (handled && (regs->msr & MSR_RI)) + mce->disposition = MCE_DISPOSITION_RECOVERED; + else + mce->disposition = MCE_DISPOSITION_NOT_RECOVERED; +--- a/arch/powerpc/platforms/powernv/opal.c ++++ b/arch/powerpc/platforms/powernv/opal.c +@@ -401,6 +401,7 @@ static int opal_recover_mce(struct pt_re + + if (!(regs->msr & MSR_RI)) { + /* If MSR_RI isn't set, we cannot recover */ ++ pr_err("Machine check interrupt unrecoverable: MSR(RI=0)\n"); + recovered = 0; + } else if (evt->disposition == MCE_DISPOSITION_RECOVERED) { + /* Platform corrected itself */ diff --git a/queue-4.4/powerpc-tm-fix-stack-pointer-corruption-in-__tm_recheckpoint.patch b/queue-4.4/powerpc-tm-fix-stack-pointer-corruption-in-__tm_recheckpoint.patch new file mode 100644 index 00000000000..2dc6ac6a293 --- /dev/null +++ b/queue-4.4/powerpc-tm-fix-stack-pointer-corruption-in-__tm_recheckpoint.patch @@ -0,0 +1,82 @@ +From 6bcb80143e792becfd2b9cc6a339ce523e4e2219 Mon Sep 17 00:00:00 2001 +From: Michael Neuling +Date: Wed, 6 Jul 2016 14:58:06 +1000 +Subject: powerpc/tm: Fix stack pointer corruption in __tm_recheckpoint() + +From: Michael Neuling + +commit 6bcb80143e792becfd2b9cc6a339ce523e4e2219 upstream. + +At the start of __tm_recheckpoint() we save the kernel stack pointer +(r1) in SPRG SCRATCH0 (SPRG2) so that we can restore it after the +trecheckpoint. + +Unfortunately, the same SPRG is used in the SLB miss handler. If an +SLB miss is taken between the save and restore of r1 to the SPRG, the +SPRG is changed and hence r1 is also corrupted. We can end up with +the following crash when we start using r1 again after the restore +from the SPRG: + + Oops: Bad kernel stack pointer, sig: 6 [#1] + SMP NR_CPUS=2048 NUMA pSeries + CPU: 658 PID: 143777 Comm: htm_demo Tainted: G EL X 4.4.13-0-default #1 + task: c0000b56993a7810 ti: c00000000cfec000 task.ti: c0000b56993bc000 + NIP: c00000000004f188 LR: 00000000100040b8 CTR: 0000000010002570 + REGS: c00000000cfefd40 TRAP: 0300 Tainted: G EL X (4.4.13-0-default) + MSR: 8000000300001033 CR: 02000424 XER: 20000000 + CFAR: c000000000008468 DAR: 00003ffd84e66880 DSISR: 40000000 SOFTE: 0 + PACATMSCRATCH: 00003ffbc865e680 + GPR00: fffffffcfabc4268 00003ffd84e667a0 00000000100d8c38 000000030544bb80 + GPR04: 0000000000000002 00000000100cf200 0000000000000449 00000000100cf100 + GPR08: 000000000000c350 0000000000002569 0000000000002569 00000000100d6c30 + GPR12: 00000000100d6c28 c00000000e6a6b00 00003ffd84660000 0000000000000000 + GPR16: 0000000000000003 0000000000000449 0000000010002570 0000010009684f20 + GPR20: 0000000000800000 00003ffd84e5f110 00003ffd84e5f7a0 00000000100d0f40 + GPR24: 0000000000000000 0000000000000000 0000000000000000 00003ffff0673f50 + GPR28: 00003ffd84e5e960 00000000003d0f00 00003ffd84e667a0 00003ffd84e5e680 + NIP [c00000000004f188] restore_gprs+0x110/0x17c + LR [00000000100040b8] 0x100040b8 + Call Trace: + Instruction dump: + f8a1fff0 e8e700a8 38a00000 7ca10164 e8a1fff8 e821fff0 7c0007dd 7c421378 + 7db142a6 7c3242a6 38800002 7c810164 e9e100e8 ea0100f0 ea2100f8 + +We hit this on large memory machines (> 2TB) but it can also be hit on +smaller machines when 1TB segments are disabled. + +To hit this, you also need to be virtualised to ensure SLBs are +periodically removed by the hypervisor. + +This patches moves the saving of r1 to the SPRG to the region where we +are guaranteed not to take any further SLB misses. + +Fixes: 98ae22e15b43 ("powerpc: Add helper functions for transactional memory context switching") +Cc: stable@vger.kernel.org # v3.9+ +Signed-off-by: Michael Neuling +Acked-by: Cyril Bur +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/kernel/tm.S | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/arch/powerpc/kernel/tm.S ++++ b/arch/powerpc/kernel/tm.S +@@ -352,8 +352,6 @@ _GLOBAL(__tm_recheckpoint) + */ + subi r7, r7, STACK_FRAME_OVERHEAD + +- SET_SCRATCH0(r1) +- + mfmsr r6 + /* R4 = original MSR to indicate whether thread used FP/Vector etc. */ + +@@ -482,6 +480,7 @@ restore_gprs: + * until we turn MSR RI back on. + */ + ++ SET_SCRATCH0(r1) + ld r5, -8(r1) + ld r1, -16(r1) + diff --git a/queue-4.4/sctp-fix-the-transports-round-robin-issue-when-init-is-retransmitted.patch b/queue-4.4/sctp-fix-the-transports-round-robin-issue-when-init-is-retransmitted.patch new file mode 100644 index 00000000000..f3362b35916 --- /dev/null +++ b/queue-4.4/sctp-fix-the-transports-round-robin-issue-when-init-is-retransmitted.patch @@ -0,0 +1,74 @@ +From 39d2adebf137de5f900843f69f5e500932e31047 Mon Sep 17 00:00:00 2001 +From: Xin Long +Date: Thu, 10 Mar 2016 15:31:57 +0800 +Subject: sctp: fix the transports round robin issue when init is retransmitted + +From: Xin Long + +commit 39d2adebf137de5f900843f69f5e500932e31047 upstream. + +prior to this patch, at the beginning if we have two paths in one assoc, +they may have the same params other than the last_time_heard, it will try +the paths like this: + +1st cycle + try trans1 fail. + then trans2 is selected.(cause it's last_time_heard is after trans1). + +2nd cycle: + try trans2 fail + then trans2 is selected.(cause it's last_time_heard is after trans1). + +3rd cycle: + try trans2 fail + then trans2 is selected.(cause it's last_time_heard is after trans1). + +.... + +trans1 will never have change to be selected, which is not what we expect. +we should keeping round robin all the paths if they are just added at the +beginning. + +So at first every tranport's last_time_heard should be initialized 0, so +that we ensure they have the same value at the beginning, only by this, +all the transports could get equal chance to be selected. + +Then for sctp_trans_elect_best, it should return the trans_next one when +*trans == *trans_next, so that we can try next if it fails, but now it +always return trans. so we can fix it by exchanging these two params when +we calls sctp_trans_elect_tie(). + +Fixes: 4c47af4d5eb2 ('net: sctp: rework multihoming retransmission path selection to rfc4960') +Signed-off-by: Xin Long +Acked-by: Daniel Borkmann +Acked-by: Marcelo Ricardo Leitner +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + net/sctp/associola.c | 2 +- + net/sctp/transport.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/net/sctp/associola.c ++++ b/net/sctp/associola.c +@@ -1290,7 +1290,7 @@ static struct sctp_transport *sctp_trans + if (score_curr > score_best) + return curr; + else if (score_curr == score_best) +- return sctp_trans_elect_tie(curr, best); ++ return sctp_trans_elect_tie(best, curr); + else + return best; + } +--- a/net/sctp/transport.c ++++ b/net/sctp/transport.c +@@ -72,7 +72,7 @@ static struct sctp_transport *sctp_trans + */ + peer->rto = msecs_to_jiffies(net->sctp.rto_initial); + +- peer->last_time_heard = ktime_get(); ++ peer->last_time_heard = ktime_set(0, 0); + peer->last_time_ecne_reduced = jiffies; + + peer->param_flags = SPP_HB_DISABLE | diff --git a/queue-4.4/series b/queue-4.4/series index 1292bb3b273..21fea87aea7 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -143,3 +143,23 @@ clk-rockchip-revert-clk-rockchip-reset-init-state-before-mmc-card-initialization mmc-dw_mmc-rockchip-set-the-drive-phase-properly.patch mmc-moxart-fix-wait_for_completion_interruptible_timeout-return-variable-type.patch mmc-sdhci-fix-regression-setting-power-on-trats2-board.patch +perf-tools-fix-perf-regs-mask-generation.patch +powerpc-tm-fix-stack-pointer-corruption-in-__tm_recheckpoint.patch +powerpc-book3s-fix-mce-console-messages-for-unrecoverable-mce.patch +sctp-fix-the-transports-round-robin-issue-when-init-is-retransmitted.patch +sunrpc-update-rpcbind_maxnetidlen.patch +nfc-nci-memory-leak-in-nci_core_conn_create.patch +net-phy-avoid-polling-phy-with-phy_ignore_interrupts.patch +net-phy-fix-phy_mac_interrupt.patch +net-phy-bcm7xxx-fix-shadow-mode-2-disabling.patch +net-ethernet-fs_enet-fix-fixed-link-phydev-leaks.patch +net-ethernet-gianfar-fix-fixed-link-phydev-leaks.patch +net-ethernet-marvell-mvneta-fix-fixed-link-phydev-leaks.patch +net-ethernet-ucc_geth-fix-fixed-link-phydev-leaks.patch +of_mdio-fix-node-leak-in-of_phy_register_fixed_link-error-path.patch +phy-micrel-fix-finding-phy-properties-in-mac-node-for-ksz9031.patch +phy-micrel-disable-auto-negotiation-on-startup.patch +net-dsa-slave-fix-of-node-leak-and-phy-priority.patch +drivers-net-cpsw-don-t-ignore-phy-mode-if-phy-handle-is-used.patch +iommu-dma-respect-iommu-aperture-when-allocating.patch +mdio-sun4i-oops-in-error-handling-in-probe.patch diff --git a/queue-4.4/sunrpc-update-rpcbind_maxnetidlen.patch b/queue-4.4/sunrpc-update-rpcbind_maxnetidlen.patch new file mode 100644 index 00000000000..5656b3b92d4 --- /dev/null +++ b/queue-4.4/sunrpc-update-rpcbind_maxnetidlen.patch @@ -0,0 +1,36 @@ +From 4b9c7f9db9a003f5c342184dc4401c1b7f2efb39 Mon Sep 17 00:00:00 2001 +From: Chuck Lever +Date: Mon, 2 May 2016 14:40:31 -0400 +Subject: sunrpc: Update RPCBIND_MAXNETIDLEN + +From: Chuck Lever + +commit 4b9c7f9db9a003f5c342184dc4401c1b7f2efb39 upstream. + +Commit 176e21ee2ec8 ("SUNRPC: Support for RPC over AF_LOCAL +transports") added a 5-character netid, but did not bump +RPCBIND_MAXNETIDLEN from 4 to 5. + +Fixes: 176e21ee2ec8 ("SUNRPC: Support for RPC over AF_LOCAL ...") +Signed-off-by: Chuck Lever +Signed-off-by: Anna Schumaker +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/sunrpc/msg_prot.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/include/linux/sunrpc/msg_prot.h ++++ b/include/linux/sunrpc/msg_prot.h +@@ -158,9 +158,9 @@ typedef __be32 rpc_fraghdr; + + /* + * Note that RFC 1833 does not put any size restrictions on the +- * netid string, but all currently defined netid's fit in 4 bytes. ++ * netid string, but all currently defined netid's fit in 5 bytes. + */ +-#define RPCBIND_MAXNETIDLEN (4u) ++#define RPCBIND_MAXNETIDLEN (5u) + + /* + * Universal addresses are introduced in RFC 1833 and further spelled -- 2.47.3