From e5610b182edbfb209bdc05e0801c9ae86c323db1 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 6 Sep 2020 22:55:57 -0400 Subject: [PATCH] Fixes for 4.14 Signed-off-by: Sasha Levin --- ...-uninitialized-chaddr-when-handling-.patch | 52 +++++ ...se-netif_rx_ni-when-not-in-interrupt.patch | 42 ++++ ...fix-own-ogm-check-in-aggregated-ogms.patch | 65 ++++++ ...-check-for-zero-dir-entries-in-nvram.patch | 39 ++++ ...t_en-fix-pci-aer-error-recovery-flow.patch | 46 ++++ ...ac-check-return-value-of-of_find_dev.patch | 39 ++++ ...-fix-of_dma_router_xlate-s-of_dma_xl.patch | 47 ++++ ...fix-burst-length-if-burst-size-is-sm.patch | 48 ++++ ...adeon-prefer-lower-feedback-dividers.patch | 48 ++++ ...n-epoll-keep-a-reference-on-files-ad.patch | 42 ++++ ...a_link-info-to-msg-sent-to-userspace.patch | 36 +++ ...g2.h-add-missing-around-n-in-roundup.patch | 37 ++++ ...lize-iommu-gcmd-register-modificatio.patch | 62 ++++++ ...call-bmips_cpu_setup-for-secondary-c.patch | 37 ++++ ...ps5000-has-inclusive-physical-caches.patch | 41 ++++ ...c_emac-fix-memleak-in-arc_mdio_probe.patch | 36 +++ ...4-fix-memory-allocation-in-mlx4_budd.patch | 44 ++++ ...hns-fix-memleak-in-hns_nic_dev_probe.patch | 50 +++++ ...ort-fix-memleak-in-bcm_sysport_probe.patch | 40 ++++ ...les-add-nfta_set_userdata-if-not-nul.patch | 36 +++ ...les-fix-destination-register-zeroing.patch | 82 +++++++ ...les-incorrect-enum-nft_list_attribut.patch | 35 +++ ...issed-_irqsave-version-of-spin_lock-.patch | 44 ++++ ...rf-tools-correct-snoopx-field-offset.patch | 51 +++++ ...b-fixed-to-be-able-to-unload-modules.patch | 208 ++++++++++++++++++ queue-4.14/series | 27 +++ ...oft-lockup-when-tg3_reset_task-fails.patch | 80 +++++++ ...hermal-fix-bogus-thermal-shutdowns-f.patch | 110 +++++++++ 28 files changed, 1524 insertions(+) create mode 100644 queue-4.14/batman-adv-avoid-uninitialized-chaddr-when-handling-.patch create mode 100644 queue-4.14/batman-adv-bla-use-netif_rx_ni-when-not-in-interrupt.patch create mode 100644 queue-4.14/batman-adv-fix-own-ogm-check-in-aggregated-ogms.patch create mode 100644 queue-4.14/bnxt_en-check-for-zero-dir-entries-in-nvram.patch create mode 100644 queue-4.14/bnxt_en-fix-pci-aer-error-recovery-flow.patch create mode 100644 queue-4.14/dmaengine-at_hdmac-check-return-value-of-of_find_dev.patch create mode 100644 queue-4.14/dmaengine-of-dma-fix-of_dma_router_xlate-s-of_dma_xl.patch create mode 100644 queue-4.14/dmaengine-pl330-fix-burst-length-if-burst-size-is-sm.patch create mode 100644 queue-4.14/drm-radeon-prefer-lower-feedback-dividers.patch create mode 100644 queue-4.14/fix-regression-in-epoll-keep-a-reference-on-files-ad.patch create mode 100644 queue-4.14/gtp-add-gtpa_link-info-to-msg-sent-to-userspace.patch create mode 100644 queue-4.14/include-linux-log2.h-add-missing-around-n-in-roundup.patch create mode 100644 queue-4.14/iommu-vt-d-serialize-iommu-gcmd-register-modificatio.patch create mode 100644 queue-4.14/mips-bmips-also-call-bmips_cpu_setup-for-secondary-c.patch create mode 100644 queue-4.14/mips-mm-bmips5000-has-inclusive-physical-caches.patch create mode 100644 queue-4.14/net-arc_emac-fix-memleak-in-arc_mdio_probe.patch create mode 100644 queue-4.14/net-ethernet-mlx4-fix-memory-allocation-in-mlx4_budd.patch create mode 100644 queue-4.14/net-hns-fix-memleak-in-hns_nic_dev_probe.patch create mode 100644 queue-4.14/net-systemport-fix-memleak-in-bcm_sysport_probe.patch create mode 100644 queue-4.14/netfilter-nf_tables-add-nfta_set_userdata-if-not-nul.patch create mode 100644 queue-4.14/netfilter-nf_tables-fix-destination-register-zeroing.patch create mode 100644 queue-4.14/netfilter-nf_tables-incorrect-enum-nft_list_attribut.patch create mode 100644 queue-4.14/nvmet-fc-fix-a-missed-_irqsave-version-of-spin_lock-.patch create mode 100644 queue-4.14/perf-tools-correct-snoopx-field-offset.patch create mode 100644 queue-4.14/ravb-fixed-to-be-able-to-unload-modules.patch create mode 100644 queue-4.14/tg3-fix-soft-lockup-when-tg3_reset_task-fails.patch create mode 100644 queue-4.14/thermal-ti-soc-thermal-fix-bogus-thermal-shutdowns-f.patch diff --git a/queue-4.14/batman-adv-avoid-uninitialized-chaddr-when-handling-.patch b/queue-4.14/batman-adv-avoid-uninitialized-chaddr-when-handling-.patch new file mode 100644 index 00000000000..a9058fe0ab8 --- /dev/null +++ b/queue-4.14/batman-adv-avoid-uninitialized-chaddr-when-handling-.patch @@ -0,0 +1,52 @@ +From 847487328b834a9989325dc6393b9bd9ca2a6d18 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Jul 2020 20:36:43 +0200 +Subject: batman-adv: Avoid uninitialized chaddr when handling DHCP + +From: Sven Eckelmann + +[ Upstream commit 303216e76dcab6049c9d42390b1032f0649a8206 ] + +The gateway client code can try to optimize the delivery of DHCP packets to +avoid broadcasting them through the whole mesh. But also transmissions to +the client can be optimized by looking up the destination via the chaddr of +the DHCP packet. + +But the chaddr is currently only done when chaddr is fully inside the +non-paged area of the skbuff. Otherwise it will not be initialized and the +unoptimized path should have been taken. + +But the implementation didn't handle this correctly. It didn't retrieve the +correct chaddr but still tried to perform the TT lookup with this +uninitialized memory. + +Reported-by: syzbot+ab16e463b903f5a37036@syzkaller.appspotmail.com +Fixes: 6c413b1c22a2 ("batman-adv: send every DHCP packet as bat-unicast") +Signed-off-by: Sven Eckelmann +Acked-by: Antonio Quartulli +Signed-off-by: Simon Wunderlich +Signed-off-by: Sasha Levin +--- + net/batman-adv/gateway_client.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c +index c6a7341f05270..056af2eec4a2a 100644 +--- a/net/batman-adv/gateway_client.c ++++ b/net/batman-adv/gateway_client.c +@@ -674,8 +674,10 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, + + chaddr_offset = *header_len + BATADV_DHCP_CHADDR_OFFSET; + /* store the client address if the message is going to a client */ +- if (ret == BATADV_DHCP_TO_CLIENT && +- pskb_may_pull(skb, chaddr_offset + ETH_ALEN)) { ++ if (ret == BATADV_DHCP_TO_CLIENT) { ++ if (!pskb_may_pull(skb, chaddr_offset + ETH_ALEN)) ++ return BATADV_DHCP_NO; ++ + /* check if the DHCP packet carries an Ethernet DHCP */ + p = skb->data + *header_len + BATADV_DHCP_HTYPE_OFFSET; + if (*p != BATADV_DHCP_HTYPE_ETHERNET) +-- +2.25.1 + diff --git a/queue-4.14/batman-adv-bla-use-netif_rx_ni-when-not-in-interrupt.patch b/queue-4.14/batman-adv-bla-use-netif_rx_ni-when-not-in-interrupt.patch new file mode 100644 index 00000000000..21723f84c01 --- /dev/null +++ b/queue-4.14/batman-adv-bla-use-netif_rx_ni-when-not-in-interrupt.patch @@ -0,0 +1,42 @@ +From 1751acfaf492003f56d84568d4b6ea0939050e87 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 Aug 2020 17:46:10 +0300 +Subject: batman-adv: bla: use netif_rx_ni when not in interrupt context + +From: Jussi Kivilinna + +[ Upstream commit 279e89b2281af3b1a9f04906e157992c19c9f163 ] + +batadv_bla_send_claim() gets called from worker thread context through +batadv_bla_periodic_work(), thus netif_rx_ni needs to be used in that +case. This fixes "NOHZ: local_softirq_pending 08" log messages seen +when batman-adv is enabled. + +Fixes: 23721387c409 ("batman-adv: add basic bridge loop avoidance code") +Signed-off-by: Jussi Kivilinna +Signed-off-by: Sven Eckelmann +Signed-off-by: Simon Wunderlich +Signed-off-by: Sasha Levin +--- + net/batman-adv/bridge_loop_avoidance.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c +index c761c0c233e4b..ae647fa69ce85 100644 +--- a/net/batman-adv/bridge_loop_avoidance.c ++++ b/net/batman-adv/bridge_loop_avoidance.c +@@ -450,7 +450,10 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac, + batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES, + skb->len + ETH_HLEN); + +- netif_rx(skb); ++ if (in_interrupt()) ++ netif_rx(skb); ++ else ++ netif_rx_ni(skb); + out: + if (primary_if) + batadv_hardif_put(primary_if); +-- +2.25.1 + diff --git a/queue-4.14/batman-adv-fix-own-ogm-check-in-aggregated-ogms.patch b/queue-4.14/batman-adv-fix-own-ogm-check-in-aggregated-ogms.patch new file mode 100644 index 00000000000..c27402369ef --- /dev/null +++ b/queue-4.14/batman-adv-fix-own-ogm-check-in-aggregated-ogms.patch @@ -0,0 +1,65 @@ +From 4f6fdbb05f0128aab4e344d8db8c8fc6a23bf2aa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jul 2020 14:28:08 +0200 +Subject: batman-adv: Fix own OGM check in aggregated OGMs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Linus Lüssing + +[ Upstream commit d8bf0c01642275c7dca1e5d02c34e4199c200b1f ] + +The own OGM check is currently misplaced and can lead to the following +issues: + +For one thing we might receive an aggregated OGM from a neighbor node +which has our own OGM in the first place. We would then not only skip +our own OGM but erroneously also any other, following OGM in the +aggregate. + +For another, we might receive an OGM aggregate which has our own OGM in +a place other then the first one. Then we would wrongly not skip this +OGM, leading to populating the orginator and gateway table with ourself. + +Fixes: 9323158ef9f4 ("batman-adv: OGMv2 - implement originators logic") +Signed-off-by: Linus Lüssing +Signed-off-by: Sven Eckelmann +Signed-off-by: Simon Wunderlich +Signed-off-by: Sasha Levin +--- + net/batman-adv/bat_v_ogm.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c +index f0abbbdafe07f..c49c48866a3fc 100644 +--- a/net/batman-adv/bat_v_ogm.c ++++ b/net/batman-adv/bat_v_ogm.c +@@ -715,6 +715,12 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset, + ntohl(ogm_packet->seqno), ogm_throughput, ogm_packet->ttl, + ogm_packet->version, ntohs(ogm_packet->tvlv_len)); + ++ if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) { ++ batadv_dbg(BATADV_DBG_BATMAN, bat_priv, ++ "Drop packet: originator packet from ourself\n"); ++ return; ++ } ++ + /* If the throughput metric is 0, immediately drop the packet. No need + * to create orig_node / neigh_node for an unusable route. + */ +@@ -842,11 +848,6 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb, + if (batadv_is_my_mac(bat_priv, ethhdr->h_source)) + goto free_skb; + +- ogm_packet = (struct batadv_ogm2_packet *)skb->data; +- +- if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) +- goto free_skb; +- + batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX); + batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES, + skb->len + ETH_HLEN); +-- +2.25.1 + diff --git a/queue-4.14/bnxt_en-check-for-zero-dir-entries-in-nvram.patch b/queue-4.14/bnxt_en-check-for-zero-dir-entries-in-nvram.patch new file mode 100644 index 00000000000..724386f61bd --- /dev/null +++ b/queue-4.14/bnxt_en-check-for-zero-dir-entries-in-nvram.patch @@ -0,0 +1,39 @@ +From 3dbbf99ccfcf4422a2fcf495d428949f0aef1bcf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Aug 2020 01:08:33 -0400 +Subject: bnxt_en: Check for zero dir entries in NVRAM. + +From: Vasundhara Volam + +[ Upstream commit dbbfa96ad920c50d58bcaefa57f5f33ceef9d00e ] + +If firmware goes into unstable state, HWRM_NVM_GET_DIR_INFO firmware +command may return zero dir entries. Return error in such case to +avoid zero length dma buffer request. + +Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") +Signed-off-by: Vasundhara Volam +Signed-off-by: Michael Chan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +index 6edbbfc1709a2..a38433cb9015d 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +@@ -1761,6 +1761,9 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data) + if (rc != 0) + return rc; + ++ if (!dir_entries || !entry_length) ++ return -EIO; ++ + /* Insert 2 bytes of directory info (count and size of entries) */ + if (len < 2) + return -EINVAL; +-- +2.25.1 + diff --git a/queue-4.14/bnxt_en-fix-pci-aer-error-recovery-flow.patch b/queue-4.14/bnxt_en-fix-pci-aer-error-recovery-flow.patch new file mode 100644 index 00000000000..9dc9e728192 --- /dev/null +++ b/queue-4.14/bnxt_en-fix-pci-aer-error-recovery-flow.patch @@ -0,0 +1,46 @@ +From 4d6908110b1e6867d9db13fb666a98b5e4c56f5a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Aug 2020 01:08:35 -0400 +Subject: bnxt_en: Fix PCI AER error recovery flow + +From: Vasundhara Volam + +[ Upstream commit df3875ec550396974b1d8a518bd120d034738236 ] + +When a PCI error is detected the PCI state could be corrupt, save +the PCI state after initialization and restore it after the slot +reset. + +Fixes: 6316ea6db93d ("bnxt_en: Enable AER support.") +Signed-off-by: Vasundhara Volam +Signed-off-by: Michael Chan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +index a189061d8f97e..7de38ae5c18f2 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +@@ -8251,6 +8251,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + + bnxt_parse_log_pcie_link(bp); + ++ pci_save_state(pdev); + return 0; + + init_err_cleanup_tc: +@@ -8412,6 +8413,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) + "Cannot re-enable PCI device after reset.\n"); + } else { + pci_set_master(pdev); ++ pci_restore_state(pdev); ++ pci_save_state(pdev); + + err = bnxt_hwrm_func_reset(bp); + if (!err && netif_running(netdev)) +-- +2.25.1 + diff --git a/queue-4.14/dmaengine-at_hdmac-check-return-value-of-of_find_dev.patch b/queue-4.14/dmaengine-at_hdmac-check-return-value-of-of_find_dev.patch new file mode 100644 index 00000000000..1b6f6aeee6b --- /dev/null +++ b/queue-4.14/dmaengine-at_hdmac-check-return-value-of-of_find_dev.patch @@ -0,0 +1,39 @@ +From 8b5a143fec3e825b96bc6174d958f38dd71bcd30 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Aug 2020 19:57:26 +0800 +Subject: dmaengine: at_hdmac: check return value of of_find_device_by_node() + in at_dma_xlate() + +From: Yu Kuai + +[ Upstream commit 0cef8e2c5a07d482ec907249dbd6687e8697677f ] + +The reurn value of of_find_device_by_node() is not checked, thus null +pointer dereference will be triggered if of_find_device_by_node() +failed. + +Fixes: bbe89c8e3d59 ("at_hdmac: move to generic DMA binding") +Signed-off-by: Yu Kuai +Link: https://lore.kernel.org/r/20200817115728.1706719-2-yukuai3@huawei.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/at_hdmac.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c +index 21ed0e20c5d91..cf3225a229890 100644 +--- a/drivers/dma/at_hdmac.c ++++ b/drivers/dma/at_hdmac.c +@@ -1677,6 +1677,8 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, + return NULL; + + dmac_pdev = of_find_device_by_node(dma_spec->np); ++ if (!dmac_pdev) ++ return NULL; + + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); +-- +2.25.1 + diff --git a/queue-4.14/dmaengine-of-dma-fix-of_dma_router_xlate-s-of_dma_xl.patch b/queue-4.14/dmaengine-of-dma-fix-of_dma_router_xlate-s-of_dma_xl.patch new file mode 100644 index 00000000000..2dcedbc7fb5 --- /dev/null +++ b/queue-4.14/dmaengine-of-dma-fix-of_dma_router_xlate-s-of_dma_xl.patch @@ -0,0 +1,47 @@ +From 43ebefd5cc532c73fce07a93568bc73d4fc2c548 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Aug 2020 13:49:28 +0300 +Subject: dmaengine: of-dma: Fix of_dma_router_xlate's of_dma_xlate handling + +From: Peter Ujfalusi + +[ Upstream commit 5b2aa9f918f6837ae943557f8cec02c34fcf80e7 ] + +of_dma_xlate callback can return ERR_PTR as well NULL in case of failure. + +If error code is returned (not NULL) then the route should be released and +the router should not be registered for the channel. + +Fixes: 56f13c0d9524c ("dmaengine: of_dma: Support for DMA routers") +Signed-off-by: Peter Ujfalusi +Link: https://lore.kernel.org/r/20200806104928.25975-1-peter.ujfalusi@ti.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/of-dma.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c +index 91fd395c90c4c..8344a60c2131b 100644 +--- a/drivers/dma/of-dma.c ++++ b/drivers/dma/of-dma.c +@@ -72,12 +72,12 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec, + return NULL; + + chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target); +- if (chan) { +- chan->router = ofdma->dma_router; +- chan->route_data = route_data; +- } else { ++ if (IS_ERR_OR_NULL(chan)) { + ofdma->dma_router->route_free(ofdma->dma_router->dev, + route_data); ++ } else { ++ chan->router = ofdma->dma_router; ++ chan->route_data = route_data; + } + + /* +-- +2.25.1 + diff --git a/queue-4.14/dmaengine-pl330-fix-burst-length-if-burst-size-is-sm.patch b/queue-4.14/dmaengine-pl330-fix-burst-length-if-burst-size-is-sm.patch new file mode 100644 index 00000000000..bb0e5523576 --- /dev/null +++ b/queue-4.14/dmaengine-pl330-fix-burst-length-if-burst-size-is-sm.patch @@ -0,0 +1,48 @@ +From f1be30698875066fa6c212eb2852875271b857b8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Aug 2020 08:46:17 +0200 +Subject: dmaengine: pl330: Fix burst length if burst size is smaller than bus + width + +From: Marek Szyprowski + +[ Upstream commit 0661cef675d37e2c4b66a996389ebeae8568e49e ] + +Move the burst len fixup after setting the generic value for it. This +finally enables the fixup introduced by commit 137bd11090d8 ("dmaengine: +pl330: Align DMA memcpy operations to MFIFO width"), which otherwise was +overwritten by the generic value. + +Reported-by: kernel test robot +Fixes: 137bd11090d8 ("dmaengine: pl330: Align DMA memcpy operations to MFIFO width") +Signed-off-by: Marek Szyprowski +Link: https://lore.kernel.org/r/20200825064617.16193-1-m.szyprowski@samsung.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/pl330.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c +index b4fa555a243f9..ff8b7042d28f4 100644 +--- a/drivers/dma/pl330.c ++++ b/drivers/dma/pl330.c +@@ -2661,6 +2661,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, + while (burst != (1 << desc->rqcfg.brst_size)) + desc->rqcfg.brst_size++; + ++ desc->rqcfg.brst_len = get_burst_len(desc, len); + /* + * If burst size is smaller than bus width then make sure we only + * transfer one at a time to avoid a burst stradling an MFIFO entry. +@@ -2668,7 +2669,6 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, + if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) + desc->rqcfg.brst_len = 1; + +- desc->rqcfg.brst_len = get_burst_len(desc, len); + desc->bytes_requested = len; + + desc->txd.flags = flags; +-- +2.25.1 + diff --git a/queue-4.14/drm-radeon-prefer-lower-feedback-dividers.patch b/queue-4.14/drm-radeon-prefer-lower-feedback-dividers.patch new file mode 100644 index 00000000000..9cc614fca44 --- /dev/null +++ b/queue-4.14/drm-radeon-prefer-lower-feedback-dividers.patch @@ -0,0 +1,48 @@ +From f0017149b95cf85490795cd32e7f5d071c35b8f4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Aug 2020 01:33:48 +0800 +Subject: drm/radeon: Prefer lower feedback dividers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Kai-Heng Feng + +[ Upstream commit fc8c70526bd30733ea8667adb8b8ffebea30a8ed ] + +Commit 2e26ccb119bd ("drm/radeon: prefer lower reference dividers") +fixed screen flicker for HP Compaq nx9420 but breaks other laptops like +Asus X50SL. + +Turns out we also need to favor lower feedback dividers. + +Users confirmed this change fixes the regression and doesn't regress the +original fix. + +Fixes: 2e26ccb119bd ("drm/radeon: prefer lower reference dividers") +BugLink: https://bugs.launchpad.net/bugs/1791312 +BugLink: https://bugs.launchpad.net/bugs/1861554 +Reviewed-by: Christian König +Signed-off-by: Kai-Heng Feng +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/radeon/radeon_display.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c +index b2334349799d1..f1de68340944b 100644 +--- a/drivers/gpu/drm/radeon/radeon_display.c ++++ b/drivers/gpu/drm/radeon/radeon_display.c +@@ -928,7 +928,7 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div, + + /* get matching reference and feedback divider */ + *ref_div = min(max(den/post_div, 1u), ref_div_max); +- *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den); ++ *fb_div = max(nom * *ref_div * post_div / den, 1u); + + /* limit fb divider to its maximum */ + if (*fb_div > fb_div_max) { +-- +2.25.1 + diff --git a/queue-4.14/fix-regression-in-epoll-keep-a-reference-on-files-ad.patch b/queue-4.14/fix-regression-in-epoll-keep-a-reference-on-files-ad.patch new file mode 100644 index 00000000000..709bce913ef --- /dev/null +++ b/queue-4.14/fix-regression-in-epoll-keep-a-reference-on-files-ad.patch @@ -0,0 +1,42 @@ +From 14cf3e75f10204dfe32f7b6808ff91d19ccff1f5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 2 Sep 2020 11:30:48 -0400 +Subject: fix regression in "epoll: Keep a reference on files added to the + check list" + +From: Al Viro + +[ Upstream commit 77f4689de17c0887775bb77896f4cc11a39bf848 ] + +epoll_loop_check_proc() can run into a file already committed to destruction; +we can't grab a reference on those and don't need to add them to the set for +reverse path check anyway. + +Tested-by: Marc Zyngier +Fixes: a9ed4a6560b8 ("epoll: Keep a reference on files added to the check list") +Signed-off-by: Al Viro +Signed-off-by: Sasha Levin +--- + fs/eventpoll.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/fs/eventpoll.c b/fs/eventpoll.c +index 00f0902e27e88..af9dfa494b1fa 100644 +--- a/fs/eventpoll.c ++++ b/fs/eventpoll.c +@@ -1901,9 +1901,9 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) + * during ep_insert(). + */ + if (list_empty(&epi->ffd.file->f_tfile_llink)) { +- get_file(epi->ffd.file); +- list_add(&epi->ffd.file->f_tfile_llink, +- &tfile_check_list); ++ if (get_file_rcu(epi->ffd.file)) ++ list_add(&epi->ffd.file->f_tfile_llink, ++ &tfile_check_list); + } + } + } +-- +2.25.1 + diff --git a/queue-4.14/gtp-add-gtpa_link-info-to-msg-sent-to-userspace.patch b/queue-4.14/gtp-add-gtpa_link-info-to-msg-sent-to-userspace.patch new file mode 100644 index 00000000000..743a22d74ea --- /dev/null +++ b/queue-4.14/gtp-add-gtpa_link-info-to-msg-sent-to-userspace.patch @@ -0,0 +1,36 @@ +From 954e1230a8f9600f365aea6012928ebfb9665c18 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Aug 2020 14:59:40 +0200 +Subject: gtp: add GTPA_LINK info to msg sent to userspace + +From: Nicolas Dichtel + +[ Upstream commit b274e47d9e3f4dcd4ad4028a316ec22dc4533ac7 ] + +During a dump, this attribute is essential, it enables the userspace to +know on which interface the context is linked to. + +Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)") +Signed-off-by: Nicolas Dichtel +Tested-by: Gabriel Ganne +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/gtp.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c +index 090607e725a24..d3ccd6929579a 100644 +--- a/drivers/net/gtp.c ++++ b/drivers/net/gtp.c +@@ -1187,6 +1187,7 @@ static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq, + goto nlmsg_failure; + + if (nla_put_u32(skb, GTPA_VERSION, pctx->gtp_version) || ++ nla_put_u32(skb, GTPA_LINK, pctx->dev->ifindex) || + nla_put_be32(skb, GTPA_PEER_ADDRESS, pctx->peer_addr_ip4.s_addr) || + nla_put_be32(skb, GTPA_MS_ADDRESS, pctx->ms_addr_ip4.s_addr)) + goto nla_put_failure; +-- +2.25.1 + diff --git a/queue-4.14/include-linux-log2.h-add-missing-around-n-in-roundup.patch b/queue-4.14/include-linux-log2.h-add-missing-around-n-in-roundup.patch new file mode 100644 index 00000000000..34c12958adb --- /dev/null +++ b/queue-4.14/include-linux-log2.h-add-missing-around-n-in-roundup.patch @@ -0,0 +1,37 @@ +From 28ec815fa1d3317818c655626c11752fea8f36dc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Sep 2020 16:36:19 -0700 +Subject: include/linux/log2.h: add missing () around n in roundup_pow_of_two() + +From: Jason Gunthorpe + +[ Upstream commit 428fc0aff4e59399ec719ffcc1f7a5d29a4ee476 ] + +Otherwise gcc generates warnings if the expression is complicated. + +Fixes: 312a0c170945 ("[PATCH] LOG2: Alter roundup_pow_of_two() so that it can use a ilog2() on a constant") +Signed-off-by: Jason Gunthorpe +Signed-off-by: Andrew Morton +Link: https://lkml.kernel.org/r/0-v1-8a2697e3c003+41165-log_brackets_jgg@nvidia.com +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + include/linux/log2.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/linux/log2.h b/include/linux/log2.h +index c373295f359fa..cca606609e1bc 100644 +--- a/include/linux/log2.h ++++ b/include/linux/log2.h +@@ -159,7 +159,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) + #define roundup_pow_of_two(n) \ + ( \ + __builtin_constant_p(n) ? ( \ +- (n == 1) ? 1 : \ ++ ((n) == 1) ? 1 : \ + (1UL << (ilog2((n) - 1) + 1)) \ + ) : \ + __roundup_pow_of_two(n) \ +-- +2.25.1 + diff --git a/queue-4.14/iommu-vt-d-serialize-iommu-gcmd-register-modificatio.patch b/queue-4.14/iommu-vt-d-serialize-iommu-gcmd-register-modificatio.patch new file mode 100644 index 00000000000..14093441701 --- /dev/null +++ b/queue-4.14/iommu-vt-d-serialize-iommu-gcmd-register-modificatio.patch @@ -0,0 +1,62 @@ +From 375e0983e99e1cbd2c1d388a9f9eba43d086c142 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Aug 2020 08:06:15 +0800 +Subject: iommu/vt-d: Serialize IOMMU GCMD register modifications + +From: Lu Baolu + +[ Upstream commit 6e4e9ec65078093165463c13d4eb92b3e8d7b2e8 ] + +The VT-d spec requires (10.4.4 Global Command Register, GCMD_REG General +Description) that: + +If multiple control fields in this register need to be modified, software +must serialize the modifications through multiple writes to this register. + +However, in irq_remapping.c, modifications of IRE and CFI are done in one +write. We need to do two separate writes with STS checking after each. It +also checks the status register before writing command register to avoid +unnecessary register write. + +Fixes: af8d102f999a4 ("x86/intel/irq_remapping: Clean up x2apic opt-out security warning mess") +Signed-off-by: Lu Baolu +Reviewed-by: Kevin Tian +Cc: Andy Lutomirski +Cc: Jacob Pan +Cc: Kevin Tian +Cc: Ashok Raj +Link: https://lore.kernel.org/r/20200828000615.8281-1-baolu.lu@linux.intel.com +Signed-off-by: Joerg Roedel +Signed-off-by: Sasha Levin +--- + drivers/iommu/intel_irq_remapping.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c +index 7cc5b04e30b7a..09c6b17aaf80e 100644 +--- a/drivers/iommu/intel_irq_remapping.c ++++ b/drivers/iommu/intel_irq_remapping.c +@@ -479,12 +479,18 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu) + + /* Enable interrupt-remapping */ + iommu->gcmd |= DMA_GCMD_IRE; +- iommu->gcmd &= ~DMA_GCMD_CFI; /* Block compatibility-format MSIs */ + writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG); +- + IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, + readl, (sts & DMA_GSTS_IRES), sts); + ++ /* Block compatibility-format MSIs */ ++ if (sts & DMA_GSTS_CFIS) { ++ iommu->gcmd &= ~DMA_GCMD_CFI; ++ writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG); ++ IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, ++ readl, !(sts & DMA_GSTS_CFIS), sts); ++ } ++ + /* + * With CFI clear in the Global Command register, we should be + * protected from dangerous (i.e. compatibility) interrupts +-- +2.25.1 + diff --git a/queue-4.14/mips-bmips-also-call-bmips_cpu_setup-for-secondary-c.patch b/queue-4.14/mips-bmips-also-call-bmips_cpu_setup-for-secondary-c.patch new file mode 100644 index 00000000000..713524a8f56 --- /dev/null +++ b/queue-4.14/mips-bmips-also-call-bmips_cpu_setup-for-secondary-c.patch @@ -0,0 +1,37 @@ +From fdcbb482bc25e8eaf709d3ae31c1676d6bf4f138 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 Aug 2020 11:26:45 -0700 +Subject: MIPS: BMIPS: Also call bmips_cpu_setup() for secondary cores + +From: Florian Fainelli + +[ Upstream commit e14f633b66902615cf7faa5d032b45ab8b6fb158 ] + +The initialization done by bmips_cpu_setup() typically affects both +threads of a given core, on 7435 which supports 2 cores and 2 threads, +logical CPU number 2 and 3 would not run this initialization. + +Fixes: 738a3f79027b ("MIPS: BMIPS: Add early CPU initialization code") +Signed-off-by: Florian Fainelli +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/kernel/smp-bmips.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c +index 45fbcbbf2504e..3018582794efc 100644 +--- a/arch/mips/kernel/smp-bmips.c ++++ b/arch/mips/kernel/smp-bmips.c +@@ -240,6 +240,8 @@ static int bmips_boot_secondary(int cpu, struct task_struct *idle) + */ + static void bmips_init_secondary(void) + { ++ bmips_cpu_setup(); ++ + switch (current_cpu_type()) { + case CPU_BMIPS4350: + case CPU_BMIPS4380: +-- +2.25.1 + diff --git a/queue-4.14/mips-mm-bmips5000-has-inclusive-physical-caches.patch b/queue-4.14/mips-mm-bmips5000-has-inclusive-physical-caches.patch new file mode 100644 index 00000000000..8de76da3609 --- /dev/null +++ b/queue-4.14/mips-mm-bmips5000-has-inclusive-physical-caches.patch @@ -0,0 +1,41 @@ +From 19e2f0f66ae9156a6b74b637afbf100c4132d074 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 Aug 2020 11:26:44 -0700 +Subject: MIPS: mm: BMIPS5000 has inclusive physical caches + +From: Florian Fainelli + +[ Upstream commit dbfc95f98f0158958d1f1e6bf06d74be38dbd821 ] + +When the BMIPS generic cpu-feature-overrides.h file was introduced, +cpu_has_inclusive_caches/MIPS_CPU_INCLUSIVE_CACHES was not set for +BMIPS5000 CPUs. Correct this when we have initialized the MIPS secondary +cache successfully. + +Fixes: f337967d6d87 ("MIPS: BMIPS: Add cpu-feature-overrides.h") +Signed-off-by: Florian Fainelli +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Sasha Levin +--- + arch/mips/mm/c-r4k.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c +index bacd67f5d71df..e4de107bf7fd8 100644 +--- a/arch/mips/mm/c-r4k.c ++++ b/arch/mips/mm/c-r4k.c +@@ -1781,7 +1781,11 @@ static void setup_scache(void) + printk("MIPS secondary cache %ldkB, %s, linesize %d bytes.\n", + scache_size >> 10, + way_string[c->scache.ways], c->scache.linesz); ++ ++ if (current_cpu_type() == CPU_BMIPS5000) ++ c->options |= MIPS_CPU_INCLUSIVE_CACHES; + } ++ + #else + if (!(c->scache.flags & MIPS_CACHE_NOT_PRESENT)) + panic("Dunno how to handle MIPS32 / MIPS64 second level cache"); +-- +2.25.1 + diff --git a/queue-4.14/net-arc_emac-fix-memleak-in-arc_mdio_probe.patch b/queue-4.14/net-arc_emac-fix-memleak-in-arc_mdio_probe.patch new file mode 100644 index 00000000000..ccbdc93bdc9 --- /dev/null +++ b/queue-4.14/net-arc_emac-fix-memleak-in-arc_mdio_probe.patch @@ -0,0 +1,36 @@ +From d46f8db4ea27143cdb3d03f8f712803880a66147 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 23 Aug 2020 16:56:47 +0800 +Subject: net: arc_emac: Fix memleak in arc_mdio_probe + +From: Dinghao Liu + +[ Upstream commit e2d79cd8875fa8c3cc7defa98a8cc99a1ed0c62f ] + +When devm_gpiod_get_optional() fails, bus should be +freed just like when of_mdiobus_register() fails. + +Fixes: 1bddd96cba03d ("net: arc_emac: support the phy reset for emac driver") +Signed-off-by: Dinghao Liu +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/arc/emac_mdio.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/arc/emac_mdio.c b/drivers/net/ethernet/arc/emac_mdio.c +index 0187dbf3b87df..54cdafdd067db 100644 +--- a/drivers/net/ethernet/arc/emac_mdio.c ++++ b/drivers/net/ethernet/arc/emac_mdio.c +@@ -153,6 +153,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv) + if (IS_ERR(data->reset_gpio)) { + error = PTR_ERR(data->reset_gpio); + dev_err(priv->dev, "Failed to request gpio: %d\n", error); ++ mdiobus_free(bus); + return error; + } + +-- +2.25.1 + diff --git a/queue-4.14/net-ethernet-mlx4-fix-memory-allocation-in-mlx4_budd.patch b/queue-4.14/net-ethernet-mlx4-fix-memory-allocation-in-mlx4_budd.patch new file mode 100644 index 00000000000..69f77995935 --- /dev/null +++ b/queue-4.14/net-ethernet-mlx4-fix-memory-allocation-in-mlx4_budd.patch @@ -0,0 +1,44 @@ +From 9ad20db1cd211291d4b8987db00d15773f569a2a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 31 Aug 2020 22:37:09 +0800 +Subject: net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init() + +From: Shung-Hsi Yu + +[ Upstream commit cbedcb044e9cc4e14bbe6658111224bb923094f4 ] + +On machines with much memory (> 2 TByte) and log_mtts_per_seg == 0, a +max_order of 31 will be passed to mlx_buddy_init(), which results in +s = BITS_TO_LONGS(1 << 31) becoming a negative value, leading to +kvmalloc_array() failure when it is converted to size_t. + + mlx4_core 0000:b1:00.0: Failed to initialize memory region table, aborting + mlx4_core: probe of 0000:b1:00.0 failed with error -12 + +Fix this issue by changing the left shifting operand from a signed literal to +an unsigned one. + +Fixes: 225c7b1feef1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters") +Signed-off-by: Shung-Hsi Yu +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/mellanox/mlx4/mr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c +index 20043f82c1d82..7c212d6618640 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/mr.c ++++ b/drivers/net/ethernet/mellanox/mlx4/mr.c +@@ -114,7 +114,7 @@ static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order) + goto err_out; + + for (i = 0; i <= buddy->max_order; ++i) { +- s = BITS_TO_LONGS(1 << (buddy->max_order - i)); ++ s = BITS_TO_LONGS(1UL << (buddy->max_order - i)); + buddy->bits[i] = kvmalloc_array(s, sizeof(long), GFP_KERNEL | __GFP_ZERO); + if (!buddy->bits[i]) + goto err_out_free; +-- +2.25.1 + diff --git a/queue-4.14/net-hns-fix-memleak-in-hns_nic_dev_probe.patch b/queue-4.14/net-hns-fix-memleak-in-hns_nic_dev_probe.patch new file mode 100644 index 00000000000..1ec6f01b3ca --- /dev/null +++ b/queue-4.14/net-hns-fix-memleak-in-hns_nic_dev_probe.patch @@ -0,0 +1,50 @@ +From 50695aec53b837da840fd97f8bb3f93a41bf55d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Aug 2020 13:44:42 +0800 +Subject: net: hns: Fix memleak in hns_nic_dev_probe + +From: Dinghao Liu + +[ Upstream commit 100e3345c6e719d2291e1efd5de311cc24bb9c0b ] + +hns_nic_dev_probe allocates ndev, but not free it on +two error handling paths, which may lead to memleak. + +Fixes: 63434888aaf1b ("net: hns: net: hns: enet adds support of acpi") +Signed-off-by: Dinghao Liu +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/hisilicon/hns/hns_enet.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c +index 0733745f4be6c..af832929ae287 100644 +--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c ++++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c +@@ -2433,8 +2433,10 @@ static int hns_nic_dev_probe(struct platform_device *pdev) + priv->enet_ver = AE_VERSION_1; + else if (acpi_dev_found(hns_enet_acpi_match[1].id)) + priv->enet_ver = AE_VERSION_2; +- else +- return -ENXIO; ++ else { ++ ret = -ENXIO; ++ goto out_read_prop_fail; ++ } + + /* try to find port-idx-in-ae first */ + ret = acpi_node_get_property_reference(dev->fwnode, +@@ -2446,7 +2448,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev) + priv->fwnode = acpi_fwnode_handle(args.adev); + } else { + dev_err(dev, "cannot read cfg data from OF or acpi\n"); +- return -ENXIO; ++ ret = -ENXIO; ++ goto out_read_prop_fail; + } + + ret = device_property_read_u32(dev, "port-idx-in-ae", &port_id); +-- +2.25.1 + diff --git a/queue-4.14/net-systemport-fix-memleak-in-bcm_sysport_probe.patch b/queue-4.14/net-systemport-fix-memleak-in-bcm_sysport_probe.patch new file mode 100644 index 00000000000..d7702efab3e --- /dev/null +++ b/queue-4.14/net-systemport-fix-memleak-in-bcm_sysport_probe.patch @@ -0,0 +1,40 @@ +From 130d7ecceb588180b99866aacdd55cdeb71cfffb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Aug 2020 13:58:31 +0800 +Subject: net: systemport: Fix memleak in bcm_sysport_probe + +From: Dinghao Liu + +[ Upstream commit 7ef1fc57301f3cef7201497aa27e89ccb91737fe ] + +When devm_kcalloc() fails, dev should be freed just +like what we've done in the subsequent error paths. + +Fixes: 7b78be48a8eb6 ("net: systemport: Dynamically allocate number of TX rings") +Signed-off-by: Dinghao Liu +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c +index 123ee5c11bc0c..11eb393497a2a 100644 +--- a/drivers/net/ethernet/broadcom/bcmsysport.c ++++ b/drivers/net/ethernet/broadcom/bcmsysport.c +@@ -2087,8 +2087,10 @@ static int bcm_sysport_probe(struct platform_device *pdev) + priv->tx_rings = devm_kcalloc(&pdev->dev, txq, + sizeof(struct bcm_sysport_tx_ring), + GFP_KERNEL); +- if (!priv->tx_rings) +- return -ENOMEM; ++ if (!priv->tx_rings) { ++ ret = -ENOMEM; ++ goto err_free_netdev; ++ } + + priv->is_lite = params->is_lite; + priv->num_rx_desc_words = params->num_rx_desc_words; +-- +2.25.1 + diff --git a/queue-4.14/netfilter-nf_tables-add-nfta_set_userdata-if-not-nul.patch b/queue-4.14/netfilter-nf_tables-add-nfta_set_userdata-if-not-nul.patch new file mode 100644 index 00000000000..8c0724f7574 --- /dev/null +++ b/queue-4.14/netfilter-nf_tables-add-nfta_set_userdata-if-not-nul.patch @@ -0,0 +1,36 @@ +From acd204cd9b41fa5ea91563e53a1a5c67fb067aa1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Aug 2020 14:12:54 +0200 +Subject: netfilter: nf_tables: add NFTA_SET_USERDATA if not null + +From: Pablo Neira Ayuso + +[ Upstream commit 6f03bf43ee05b31d3822def2a80f11b3591c55b3 ] + +Kernel sends an empty NFTA_SET_USERDATA attribute with no value if +userspace adds a set with no NFTA_SET_USERDATA attribute. + +Fixes: e6d8ecac9e68 ("netfilter: nf_tables: Add new attributes into nft_set to store user data.") +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/nf_tables_api.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index 5b8d5bfeb7ac5..7c95314f0b7de 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -2882,7 +2882,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, + goto nla_put_failure; + } + +- if (nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata)) ++ if (set->udata && ++ nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata)) + goto nla_put_failure; + + desc = nla_nest_start(skb, NFTA_SET_DESC); +-- +2.25.1 + diff --git a/queue-4.14/netfilter-nf_tables-fix-destination-register-zeroing.patch b/queue-4.14/netfilter-nf_tables-fix-destination-register-zeroing.patch new file mode 100644 index 00000000000..155f9ea7852 --- /dev/null +++ b/queue-4.14/netfilter-nf_tables-fix-destination-register-zeroing.patch @@ -0,0 +1,82 @@ +From 33b781b4de8c9a3deb8ee740394fb0dfd52e0586 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Aug 2020 21:05:50 +0200 +Subject: netfilter: nf_tables: fix destination register zeroing + +From: Florian Westphal + +[ Upstream commit 1e105e6afa6c3d32bfb52c00ffa393894a525c27 ] + +Following bug was reported via irc: +nft list ruleset + set knock_candidates_ipv4 { + type ipv4_addr . inet_service + size 65535 + elements = { 127.0.0.1 . 123, + 127.0.0.1 . 123 } + } + .. + udp dport 123 add @knock_candidates_ipv4 { ip saddr . 123 } + udp dport 123 add @knock_candidates_ipv4 { ip saddr . udp dport } + +It should not have been possible to add a duplicate set entry. + +After some debugging it turned out that the problem is the immediate +value (123) in the second-to-last rule. + +Concatenations use 32bit registers, i.e. the elements are 8 bytes each, +not 6 and it turns out the kernel inserted + +inet firewall @knock_candidates_ipv4 + element 0100007f ffff7b00 : 0 [end] + element 0100007f 00007b00 : 0 [end] + +Note the non-zero upper bits of the first element. It turns out that +nft_immediate doesn't zero the destination register, but this is needed +when the length isn't a multiple of 4. + +Furthermore, the zeroing in nft_payload is broken. We can't use +[len / 4] = 0 -- if len is a multiple of 4, index is off by one. + +Skip zeroing in this case and use a conditional instead of (len -1) / 4. + +Fixes: 49499c3e6e18 ("netfilter: nf_tables: switch registers to 32 bit addressing") +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + include/net/netfilter/nf_tables.h | 2 ++ + net/netfilter/nft_payload.c | 4 +++- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h +index a9704c57430db..3107895115c25 100644 +--- a/include/net/netfilter/nf_tables.h ++++ b/include/net/netfilter/nf_tables.h +@@ -136,6 +136,8 @@ static inline u8 nft_reg_load8(u32 *sreg) + static inline void nft_data_copy(u32 *dst, const struct nft_data *src, + unsigned int len) + { ++ if (len % NFT_REG32_SIZE) ++ dst[len / NFT_REG32_SIZE] = 0; + memcpy(dst, src, len); + } + +diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c +index 19446a89a2a81..b1a9f330a51fe 100644 +--- a/net/netfilter/nft_payload.c ++++ b/net/netfilter/nft_payload.c +@@ -79,7 +79,9 @@ static void nft_payload_eval(const struct nft_expr *expr, + u32 *dest = ®s->data[priv->dreg]; + int offset; + +- dest[priv->len / NFT_REG32_SIZE] = 0; ++ if (priv->len % NFT_REG32_SIZE) ++ dest[priv->len / NFT_REG32_SIZE] = 0; ++ + switch (priv->base) { + case NFT_PAYLOAD_LL_HEADER: + if (!skb_mac_header_was_set(skb)) +-- +2.25.1 + diff --git a/queue-4.14/netfilter-nf_tables-incorrect-enum-nft_list_attribut.patch b/queue-4.14/netfilter-nf_tables-incorrect-enum-nft_list_attribut.patch new file mode 100644 index 00000000000..3b557016252 --- /dev/null +++ b/queue-4.14/netfilter-nf_tables-incorrect-enum-nft_list_attribut.patch @@ -0,0 +1,35 @@ +From a8a368d0fdc33138cc080541895f9d771ac00208 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Aug 2020 14:12:55 +0200 +Subject: netfilter: nf_tables: incorrect enum nft_list_attributes definition + +From: Pablo Neira Ayuso + +[ Upstream commit da9125df854ea48a6240c66e8a67be06e2c12c03 ] + +This should be NFTA_LIST_UNSPEC instead of NFTA_LIST_UNPEC, all other +similar attribute definitions are postfixed with _UNSPEC. + +Fixes: 96518518cc41 ("netfilter: add nftables") +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + include/uapi/linux/netfilter/nf_tables.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h +index a3ee277b17a17..49b6997c32550 100644 +--- a/include/uapi/linux/netfilter/nf_tables.h ++++ b/include/uapi/linux/netfilter/nf_tables.h +@@ -125,7 +125,7 @@ enum nf_tables_msg_types { + * @NFTA_LIST_ELEM: list element (NLA_NESTED) + */ + enum nft_list_attributes { +- NFTA_LIST_UNPEC, ++ NFTA_LIST_UNSPEC, + NFTA_LIST_ELEM, + __NFTA_LIST_MAX + }; +-- +2.25.1 + diff --git a/queue-4.14/nvmet-fc-fix-a-missed-_irqsave-version-of-spin_lock-.patch b/queue-4.14/nvmet-fc-fix-a-missed-_irqsave-version-of-spin_lock-.patch new file mode 100644 index 00000000000..806b64ce633 --- /dev/null +++ b/queue-4.14/nvmet-fc-fix-a-missed-_irqsave-version-of-spin_lock-.patch @@ -0,0 +1,44 @@ +From c3b7f0a9e533f49a155f6a841b2ea53631a76724 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Aug 2020 09:58:19 +0200 +Subject: nvmet-fc: Fix a missed _irqsave version of spin_lock in + 'nvmet_fc_fod_op_done()' + +From: Christophe JAILLET + +[ Upstream commit 70e37988db94aba607d5491a94f80ba08e399b6b ] + +The way 'spin_lock()' and 'spin_lock_irqsave()' are used is not consistent +in this function. + +Use 'spin_lock_irqsave()' also here, as there is no guarantee that +interruptions are disabled at that point, according to surrounding code. + +Fixes: a97ec51b37ef ("nvmet_fc: Rework target side abort handling") +Signed-off-by: Christophe JAILLET +Reviewed-by: Christoph Hellwig +Signed-off-by: Sagi Grimberg +Signed-off-by: Sasha Levin +--- + drivers/nvme/target/fc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c +index b7a5d1065378d..df1c6dee255bf 100644 +--- a/drivers/nvme/target/fc.c ++++ b/drivers/nvme/target/fc.c +@@ -1994,9 +1994,9 @@ nvmet_fc_fod_op_done(struct nvmet_fc_fcp_iod *fod) + return; + if (fcpreq->fcp_error || + fcpreq->transferred_length != fcpreq->transfer_length) { +- spin_lock(&fod->flock); ++ spin_lock_irqsave(&fod->flock, flags); + fod->abort = true; +- spin_unlock(&fod->flock); ++ spin_unlock_irqrestore(&fod->flock, flags); + + nvmet_req_complete(&fod->req, NVME_SC_INTERNAL); + return; +-- +2.25.1 + diff --git a/queue-4.14/perf-tools-correct-snoopx-field-offset.patch b/queue-4.14/perf-tools-correct-snoopx-field-offset.patch new file mode 100644 index 00000000000..1d014c7dd72 --- /dev/null +++ b/queue-4.14/perf-tools-correct-snoopx-field-offset.patch @@ -0,0 +1,51 @@ +From 7d3631be08d518656b4f2a20a460e482ea173869 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Sep 2020 12:10:14 -0300 +Subject: perf tools: Correct SNOOPX field offset + +From: Al Grant + +[ Upstream commit 39c0a53b114d0317e5c4e76b631f41d133af5cb0 ] + +perf_event.h has macros that define the field offsets in the data_src +bitmask in perf records. The SNOOPX and REMOTE offsets were both 37. + +These are distinct fields, and the bitfield layout in perf_mem_data_src +confirms that SNOOPX should be at offset 38. + +Committer notes: + +This was extracted from a larger patch that also contained kernel +changes. + +Fixes: 52839e653b5629bd ("perf tools: Add support for printing new mem_info encodings") +Signed-off-by: Al Grant +Reviewed-by: Andi Kleen +Cc: Adrian Hunter +Cc: Ian Rogers +Cc: Jiri Olsa +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: http://lore.kernel.org/lkml/9974f2d0-bf7f-518e-d9f7-4520e5ff1bb0@foss.arm.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/include/uapi/linux/perf_event.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h +index 362493a2f950b..3b733511bb2b3 100644 +--- a/tools/include/uapi/linux/perf_event.h ++++ b/tools/include/uapi/linux/perf_event.h +@@ -1033,7 +1033,7 @@ union perf_mem_data_src { + + #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ + /* 1 free */ +-#define PERF_MEM_SNOOPX_SHIFT 37 ++#define PERF_MEM_SNOOPX_SHIFT 38 + + /* locked instruction */ + #define PERF_MEM_LOCK_NA 0x01 /* not available */ +-- +2.25.1 + diff --git a/queue-4.14/ravb-fixed-to-be-able-to-unload-modules.patch b/queue-4.14/ravb-fixed-to-be-able-to-unload-modules.patch new file mode 100644 index 00000000000..2f690ff57ab --- /dev/null +++ b/queue-4.14/ravb-fixed-to-be-able-to-unload-modules.patch @@ -0,0 +1,208 @@ +From 976bee8185f36246f364b56a7957d28db5e4612d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Aug 2020 18:43:07 +0900 +Subject: ravb: Fixed to be able to unload modules + +From: Yuusuke Ashizuka + +[ Upstream commit 1838d6c62f57836639bd3d83e7855e0ee4f6defc ] + +When this driver is built as a module, I cannot rmmod it after insmoding +it. +This is because that this driver calls ravb_mdio_init() at the time of +probe, and module->refcnt is incremented by alloc_mdio_bitbang() called +after that. +Therefore, even if ifup is not performed, the driver is in use and rmmod +cannot be performed. + +$ lsmod +Module Size Used by +ravb 40960 1 +$ rmmod ravb +rmmod: ERROR: Module ravb is in use + +Call ravb_mdio_init() at open and free_mdio_bitbang() at close, thereby +rmmod is possible in the ifdown state. + +Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") +Signed-off-by: Yuusuke Ashizuka +Reviewed-by: Sergei Shtylyov +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/ravb_main.c | 110 +++++++++++------------ + 1 file changed, 55 insertions(+), 55 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c +index 9f4d93a16b7e5..19fb3dbb80f58 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -1374,6 +1374,51 @@ static inline int ravb_hook_irq(unsigned int irq, irq_handler_t handler, + return error; + } + ++/* MDIO bus init function */ ++static int ravb_mdio_init(struct ravb_private *priv) ++{ ++ struct platform_device *pdev = priv->pdev; ++ struct device *dev = &pdev->dev; ++ int error; ++ ++ /* Bitbang init */ ++ priv->mdiobb.ops = &bb_ops; ++ ++ /* MII controller setting */ ++ priv->mii_bus = alloc_mdio_bitbang(&priv->mdiobb); ++ if (!priv->mii_bus) ++ return -ENOMEM; ++ ++ /* Hook up MII support for ethtool */ ++ priv->mii_bus->name = "ravb_mii"; ++ priv->mii_bus->parent = dev; ++ snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", ++ pdev->name, pdev->id); ++ ++ /* Register MDIO bus */ ++ error = of_mdiobus_register(priv->mii_bus, dev->of_node); ++ if (error) ++ goto out_free_bus; ++ ++ return 0; ++ ++out_free_bus: ++ free_mdio_bitbang(priv->mii_bus); ++ return error; ++} ++ ++/* MDIO bus release function */ ++static int ravb_mdio_release(struct ravb_private *priv) ++{ ++ /* Unregister mdio bus */ ++ mdiobus_unregister(priv->mii_bus); ++ ++ /* Free bitbang info */ ++ free_mdio_bitbang(priv->mii_bus); ++ ++ return 0; ++} ++ + /* Network device open function for Ethernet AVB */ + static int ravb_open(struct net_device *ndev) + { +@@ -1382,6 +1427,13 @@ static int ravb_open(struct net_device *ndev) + struct device *dev = &pdev->dev; + int error; + ++ /* MDIO bus init */ ++ error = ravb_mdio_init(priv); ++ if (error) { ++ netdev_err(ndev, "failed to initialize MDIO\n"); ++ return error; ++ } ++ + napi_enable(&priv->napi[RAVB_BE]); + napi_enable(&priv->napi[RAVB_NC]); + +@@ -1459,6 +1511,7 @@ out_free_irq: + out_napi_off: + napi_disable(&priv->napi[RAVB_NC]); + napi_disable(&priv->napi[RAVB_BE]); ++ ravb_mdio_release(priv); + return error; + } + +@@ -1757,6 +1810,8 @@ static int ravb_close(struct net_device *ndev) + ravb_ring_free(ndev, RAVB_BE); + ravb_ring_free(ndev, RAVB_NC); + ++ ravb_mdio_release(priv); ++ + return 0; + } + +@@ -1858,51 +1913,6 @@ static const struct net_device_ops ravb_netdev_ops = { + .ndo_set_mac_address = eth_mac_addr, + }; + +-/* MDIO bus init function */ +-static int ravb_mdio_init(struct ravb_private *priv) +-{ +- struct platform_device *pdev = priv->pdev; +- struct device *dev = &pdev->dev; +- int error; +- +- /* Bitbang init */ +- priv->mdiobb.ops = &bb_ops; +- +- /* MII controller setting */ +- priv->mii_bus = alloc_mdio_bitbang(&priv->mdiobb); +- if (!priv->mii_bus) +- return -ENOMEM; +- +- /* Hook up MII support for ethtool */ +- priv->mii_bus->name = "ravb_mii"; +- priv->mii_bus->parent = dev; +- snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", +- pdev->name, pdev->id); +- +- /* Register MDIO bus */ +- error = of_mdiobus_register(priv->mii_bus, dev->of_node); +- if (error) +- goto out_free_bus; +- +- return 0; +- +-out_free_bus: +- free_mdio_bitbang(priv->mii_bus); +- return error; +-} +- +-/* MDIO bus release function */ +-static int ravb_mdio_release(struct ravb_private *priv) +-{ +- /* Unregister mdio bus */ +- mdiobus_unregister(priv->mii_bus); +- +- /* Free bitbang info */ +- free_mdio_bitbang(priv->mii_bus); +- +- return 0; +-} +- + static const struct of_device_id ravb_match_table[] = { + { .compatible = "renesas,etheravb-r8a7790", .data = (void *)RCAR_GEN2 }, + { .compatible = "renesas,etheravb-r8a7794", .data = (void *)RCAR_GEN2 }, +@@ -2132,13 +2142,6 @@ static int ravb_probe(struct platform_device *pdev) + eth_hw_addr_random(ndev); + } + +- /* MDIO bus init */ +- error = ravb_mdio_init(priv); +- if (error) { +- dev_err(&pdev->dev, "failed to initialize MDIO\n"); +- goto out_dma_free; +- } +- + netif_napi_add(ndev, &priv->napi[RAVB_BE], ravb_poll, 64); + netif_napi_add(ndev, &priv->napi[RAVB_NC], ravb_poll, 64); + +@@ -2161,8 +2164,6 @@ static int ravb_probe(struct platform_device *pdev) + out_napi_del: + netif_napi_del(&priv->napi[RAVB_NC]); + netif_napi_del(&priv->napi[RAVB_BE]); +- ravb_mdio_release(priv); +-out_dma_free: + dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, + priv->desc_bat_dma); + +@@ -2195,7 +2196,6 @@ static int ravb_remove(struct platform_device *pdev) + unregister_netdev(ndev); + netif_napi_del(&priv->napi[RAVB_NC]); + netif_napi_del(&priv->napi[RAVB_BE]); +- ravb_mdio_release(priv); + pm_runtime_disable(&pdev->dev); + free_netdev(ndev); + platform_set_drvdata(pdev, NULL); +-- +2.25.1 + diff --git a/queue-4.14/series b/queue-4.14/series index 8d3cd9b627f..48190b7dea7 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -8,3 +8,30 @@ ceph-don-t-allow-setlease-on-cephfs.patch cpuidle-fixup-irq-state.patch s390-don-t-trace-preemption-in-percpu-macros.patch xen-xenbus-fix-granting-of-vmalloc-d-memory.patch +dmaengine-of-dma-fix-of_dma_router_xlate-s-of_dma_xl.patch +batman-adv-avoid-uninitialized-chaddr-when-handling-.patch +batman-adv-fix-own-ogm-check-in-aggregated-ogms.patch +batman-adv-bla-use-netif_rx_ni-when-not-in-interrupt.patch +dmaengine-at_hdmac-check-return-value-of-of_find_dev.patch +mips-mm-bmips5000-has-inclusive-physical-caches.patch +mips-bmips-also-call-bmips_cpu_setup-for-secondary-c.patch +netfilter-nf_tables-add-nfta_set_userdata-if-not-nul.patch +netfilter-nf_tables-incorrect-enum-nft_list_attribut.patch +netfilter-nf_tables-fix-destination-register-zeroing.patch +net-hns-fix-memleak-in-hns_nic_dev_probe.patch +net-systemport-fix-memleak-in-bcm_sysport_probe.patch +ravb-fixed-to-be-able-to-unload-modules.patch +net-arc_emac-fix-memleak-in-arc_mdio_probe.patch +dmaengine-pl330-fix-burst-length-if-burst-size-is-sm.patch +gtp-add-gtpa_link-info-to-msg-sent-to-userspace.patch +bnxt_en-check-for-zero-dir-entries-in-nvram.patch +bnxt_en-fix-pci-aer-error-recovery-flow.patch +nvmet-fc-fix-a-missed-_irqsave-version-of-spin_lock-.patch +perf-tools-correct-snoopx-field-offset.patch +net-ethernet-mlx4-fix-memory-allocation-in-mlx4_budd.patch +fix-regression-in-epoll-keep-a-reference-on-files-ad.patch +drm-radeon-prefer-lower-feedback-dividers.patch +tg3-fix-soft-lockup-when-tg3_reset_task-fails.patch +iommu-vt-d-serialize-iommu-gcmd-register-modificatio.patch +thermal-ti-soc-thermal-fix-bogus-thermal-shutdowns-f.patch +include-linux-log2.h-add-missing-around-n-in-roundup.patch diff --git a/queue-4.14/tg3-fix-soft-lockup-when-tg3_reset_task-fails.patch b/queue-4.14/tg3-fix-soft-lockup-when-tg3_reset_task-fails.patch new file mode 100644 index 00000000000..ed09aaf16e0 --- /dev/null +++ b/queue-4.14/tg3-fix-soft-lockup-when-tg3_reset_task-fails.patch @@ -0,0 +1,80 @@ +From ae51277b5409bea3238425075393e88ecbe87d8d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Sep 2020 14:28:54 -0400 +Subject: tg3: Fix soft lockup when tg3_reset_task() fails. + +From: Michael Chan + +[ Upstream commit 556699341efa98243e08e34401b3f601da91f5a3 ] + +If tg3_reset_task() fails, the device state is left in an inconsistent +state with IFF_RUNNING still set but NAPI state not enabled. A +subsequent operation, such as ifdown or AER error can cause it to +soft lock up when it tries to disable NAPI state. + +Fix it by bringing down the device to !IFF_RUNNING state when +tg3_reset_task() fails. tg3_reset_task() running from workqueue +will now call tg3_close() when the reset fails. We need to +modify tg3_reset_task_cancel() slightly to avoid tg3_close() +calling cancel_work_sync() to cancel tg3_reset_task(). Otherwise +cancel_work_sync() will wait forever for tg3_reset_task() to +finish. + +Reported-by: David Christensen +Reported-by: Baptiste Covolato +Fixes: db2199737990 ("tg3: Schedule at most one tg3_reset_task run") +Signed-off-by: Michael Chan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/broadcom/tg3.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c +index e40d31b405253..480179ddc45b6 100644 +--- a/drivers/net/ethernet/broadcom/tg3.c ++++ b/drivers/net/ethernet/broadcom/tg3.c +@@ -7204,8 +7204,8 @@ static inline void tg3_reset_task_schedule(struct tg3 *tp) + + static inline void tg3_reset_task_cancel(struct tg3 *tp) + { +- cancel_work_sync(&tp->reset_task); +- tg3_flag_clear(tp, RESET_TASK_PENDING); ++ if (test_and_clear_bit(TG3_FLAG_RESET_TASK_PENDING, tp->tg3_flags)) ++ cancel_work_sync(&tp->reset_task); + tg3_flag_clear(tp, TX_RECOVERY_PENDING); + } + +@@ -11182,18 +11182,27 @@ static void tg3_reset_task(struct work_struct *work) + + tg3_halt(tp, RESET_KIND_SHUTDOWN, 0); + err = tg3_init_hw(tp, true); +- if (err) ++ if (err) { ++ tg3_full_unlock(tp); ++ tp->irq_sync = 0; ++ tg3_napi_enable(tp); ++ /* Clear this flag so that tg3_reset_task_cancel() will not ++ * call cancel_work_sync() and wait forever. ++ */ ++ tg3_flag_clear(tp, RESET_TASK_PENDING); ++ dev_close(tp->dev); + goto out; ++ } + + tg3_netif_start(tp); + +-out: + tg3_full_unlock(tp); + + if (!err) + tg3_phy_start(tp); + + tg3_flag_clear(tp, RESET_TASK_PENDING); ++out: + rtnl_unlock(); + } + +-- +2.25.1 + diff --git a/queue-4.14/thermal-ti-soc-thermal-fix-bogus-thermal-shutdowns-f.patch b/queue-4.14/thermal-ti-soc-thermal-fix-bogus-thermal-shutdowns-f.patch new file mode 100644 index 00000000000..4b08dc07a03 --- /dev/null +++ b/queue-4.14/thermal-ti-soc-thermal-fix-bogus-thermal-shutdowns-f.patch @@ -0,0 +1,110 @@ +From 24a3c20b88921524b5e45c7fdd91201efb0d73f6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jul 2020 11:33:38 -0700 +Subject: thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430 + +From: Tony Lindgren + +[ Upstream commit 30d24faba0532d6972df79a1bf060601994b5873 ] + +We can sometimes get bogus thermal shutdowns on omap4430 at least with +droid4 running idle with a battery charger connected: + +thermal thermal_zone0: critical temperature reached (143 C), shutting down + +Dumping out the register values shows we can occasionally get a 0x7f value +that is outside the TRM listed values in the ADC conversion table. And then +we get a normal value when reading again after that. Reading the register +multiple times does not seem help avoiding the bogus values as they stay +until the next sample is ready. + +Looking at the TRM chapter "18.4.10.2.3 ADC Codes Versus Temperature", we +should have values from 13 to 107 listed with a total of 95 values. But +looking at the omap4430_adc_to_temp array, the values are off, and the +end values are missing. And it seems that the 4430 ADC table is similar +to omap3630 rather than omap4460. + +Let's fix the issue by using values based on the omap3630 table and just +ignoring invalid values. Compared to the 4430 TRM, the omap3630 table has +the missing values added while the TRM table only shows every second +value. + +Note that sometimes the ADC register values within the valid table can +also be way off for about 1 out of 10 values. But it seems that those +just show about 25 C too low values rather than too high values. So those +do not cause a bogus thermal shutdown. + +Fixes: 1a31270e54d7 ("staging: omap-thermal: add OMAP4 data structures") +Cc: Merlijn Wajer +Cc: Pavel Machek +Cc: Sebastian Reichel +Signed-off-by: Tony Lindgren +Signed-off-by: Daniel Lezcano +Link: https://lore.kernel.org/r/20200706183338.25622-1-tony@atomide.com +Signed-off-by: Sasha Levin +--- + .../ti-soc-thermal/omap4-thermal-data.c | 23 ++++++++++--------- + .../thermal/ti-soc-thermal/omap4xxx-bandgap.h | 10 +++++--- + 2 files changed, 19 insertions(+), 14 deletions(-) + +diff --git a/drivers/thermal/ti-soc-thermal/omap4-thermal-data.c b/drivers/thermal/ti-soc-thermal/omap4-thermal-data.c +index fd11133606038..0c3141746edfe 100644 +--- a/drivers/thermal/ti-soc-thermal/omap4-thermal-data.c ++++ b/drivers/thermal/ti-soc-thermal/omap4-thermal-data.c +@@ -49,20 +49,21 @@ static struct temp_sensor_data omap4430_mpu_temp_sensor_data = { + + /* + * Temperature values in milli degree celsius +- * ADC code values from 530 to 923 ++ * ADC code values from 13 to 107, see TRM ++ * "18.4.10.2.3 ADC Codes Versus Temperature". + */ + static const int + omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = { +- -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, -22000, +- -20000, -18000, -17000, -15000, -13000, -12000, -10000, -8000, -6000, +- -5000, -3000, -1000, 0, 2000, 3000, 5000, 6000, 8000, 10000, 12000, +- 13000, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28000, 30000, +- 32000, 33000, 35000, 37000, 38000, 40000, 42000, 43000, 45000, 47000, +- 48000, 50000, 52000, 53000, 55000, 57000, 58000, 60000, 62000, 64000, +- 66000, 68000, 70000, 71000, 73000, 75000, 77000, 78000, 80000, 82000, +- 83000, 85000, 87000, 88000, 90000, 92000, 93000, 95000, 97000, 98000, +- 100000, 102000, 103000, 105000, 107000, 109000, 111000, 113000, 115000, +- 117000, 118000, 120000, 122000, 123000, ++ -40000, -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, ++ -22000, -20000, -18500, -17000, -15000, -13500, -12000, -10000, -8000, ++ -6500, -5000, -3500, -1500, 0, 2000, 3500, 5000, 6500, 8500, 10000, ++ 12000, 13500, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28500, ++ 30000, 32000, 33500, 35000, 37000, 38500, 40000, 42000, 43500, 45000, ++ 47000, 48500, 50000, 52000, 53500, 55000, 57000, 58500, 60000, 62000, ++ 64000, 66000, 68000, 70000, 71500, 73500, 75000, 77000, 78500, 80000, ++ 82000, 83500, 85000, 87000, 88500, 90000, 92000, 93500, 95000, 97000, ++ 98500, 100000, 102000, 103500, 105000, 107000, 109000, 111000, 113000, ++ 115000, 117000, 118500, 120000, 122000, 123500, 125000, + }; + + /* OMAP4430 data */ +diff --git a/drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h b/drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h +index 6f2de3a3356d4..86850082b24b9 100644 +--- a/drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h ++++ b/drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h +@@ -67,9 +67,13 @@ + * and thresholds for OMAP4430. + */ + +-/* ADC conversion table limits */ +-#define OMAP4430_ADC_START_VALUE 0 +-#define OMAP4430_ADC_END_VALUE 127 ++/* ++ * ADC conversion table limits. Ignore values outside the TRM listed ++ * range to avoid bogus thermal shutdowns. See omap4430 TRM chapter ++ * "18.4.10.2.3 ADC Codes Versus Temperature". ++ */ ++#define OMAP4430_ADC_START_VALUE 13 ++#define OMAP4430_ADC_END_VALUE 107 + /* bandgap clock limits (no control on 4430) */ + #define OMAP4430_MAX_FREQ 32768 + #define OMAP4430_MIN_FREQ 32768 +-- +2.25.1 + -- 2.47.3