From: Sasha Levin Date: Sun, 30 Jul 2023 13:27:49 +0000 (-0400) Subject: Fixes for 6.1 X-Git-Tag: v5.15.124~80 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2d7df24cf8315c9b947e70923e33967f23862f12;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.1 Signed-off-by: Sasha Levin --- diff --git a/queue-6.1/atheros-fix-return-value-check-in-atl1_tso.patch b/queue-6.1/atheros-fix-return-value-check-in-atl1_tso.patch new file mode 100644 index 00000000000..fec024537e8 --- /dev/null +++ b/queue-6.1/atheros-fix-return-value-check-in-atl1_tso.patch @@ -0,0 +1,43 @@ +From 979b1e794ead927662977f20217ac022d8d7b688 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 22 Jul 2023 22:25:11 +0800 +Subject: atheros: fix return value check in atl1_tso() + +From: Yuanjun Gong + +[ Upstream commit ed96824b71ed67664390890441b229423a25317f ] + +in atl1_tso(), it should check the return value of pskb_trim(), +and return an error code if an unexpected value is returned +by pskb_trim(). + +Fixes: 401c0aabec4b ("atl1: simplify tx packet descriptor") +Signed-off-by: Yuanjun Gong +Link: https://lore.kernel.org/r/20230722142511.12448-1-ruc_gongyuanjun@163.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/atheros/atlx/atl1.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c +index c8444bcdf5270..02aa6fd8ebc2d 100644 +--- a/drivers/net/ethernet/atheros/atlx/atl1.c ++++ b/drivers/net/ethernet/atheros/atlx/atl1.c +@@ -2113,8 +2113,11 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb, + + real_len = (((unsigned char *)iph - skb->data) + + ntohs(iph->tot_len)); +- if (real_len < skb->len) +- pskb_trim(skb, real_len); ++ if (real_len < skb->len) { ++ err = pskb_trim(skb, real_len); ++ if (err) ++ return err; ++ } + hdr_len = skb_tcp_all_headers(skb); + if (skb->len == hdr_len) { + iph->check = 0; +-- +2.39.2 + diff --git a/queue-6.1/benet-fix-return-value-check-in-be_lancer_xmit_worka.patch b/queue-6.1/benet-fix-return-value-check-in-be_lancer_xmit_worka.patch new file mode 100644 index 00000000000..9d41bda07d5 --- /dev/null +++ b/queue-6.1/benet-fix-return-value-check-in-be_lancer_xmit_worka.patch @@ -0,0 +1,38 @@ +From 7f64923f2d3f550c63acca152ce805c2bf3dbc47 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jul 2023 11:27:26 +0800 +Subject: benet: fix return value check in be_lancer_xmit_workarounds() + +From: Yuanjun Gong + +[ Upstream commit 5c85f7065718a949902b238a6abd8fc907c5d3e0 ] + +in be_lancer_xmit_workarounds(), it should go to label 'tx_drop' +if an unexpected value is returned by pskb_trim(). + +Fixes: 93040ae5cc8d ("be2net: Fix to trim skb for padded vlan packets to workaround an ASIC Bug") +Signed-off-by: Yuanjun Gong +Link: https://lore.kernel.org/r/20230725032726.15002-1-ruc_gongyuanjun@163.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/emulex/benet/be_main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c +index 5d39df8452653..b12152e2fca0a 100644 +--- a/drivers/net/ethernet/emulex/benet/be_main.c ++++ b/drivers/net/ethernet/emulex/benet/be_main.c +@@ -1139,7 +1139,8 @@ static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter, + (lancer_chip(adapter) || BE3_chip(adapter) || + skb_vlan_tag_present(skb)) && is_ipv4_pkt(skb)) { + ip = (struct iphdr *)ip_hdr(skb); +- pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len)); ++ if (unlikely(pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len)))) ++ goto tx_drop; + } + + /* If vlan tag is already inlined in the packet, skip HW VLAN +-- +2.39.2 + diff --git a/queue-6.1/bonding-reset-bond-s-flags-when-down-link-is-p2p-dev.patch b/queue-6.1/bonding-reset-bond-s-flags-when-down-link-is-p2p-dev.patch new file mode 100644 index 00000000000..87dd657710e --- /dev/null +++ b/queue-6.1/bonding-reset-bond-s-flags-when-down-link-is-p2p-dev.patch @@ -0,0 +1,61 @@ +From f77b308cc7038514a5e533fa391e47c67f164eba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 12:03:55 +0800 +Subject: bonding: reset bond's flags when down link is P2P device + +From: Hangbin Liu + +[ Upstream commit da19a2b967cf1e2c426f50d28550d1915214a81d ] + +When adding a point to point downlink to the bond, we neglected to reset +the bond's flags, which were still using flags like BROADCAST and +MULTICAST. Consequently, this would initiate ARP/DAD for P2P downlink +interfaces, such as when adding a GRE device to the bonding. + +To address this issue, let's reset the bond's flags for P2P interfaces. + +Before fix: +7: gre0@NONE: mtu 1500 qdisc noqueue master bond0 state UNKNOWN group default qlen 1000 + link/gre6 2006:70:10::1 peer 2006:70:10::2 permaddr 167f:18:f188:: +8: bond0: mtu 1500 qdisc noqueue state UP group default qlen 1000 + link/gre6 2006:70:10::1 brd 2006:70:10::2 + inet6 fe80::200:ff:fe00:0/64 scope link + valid_lft forever preferred_lft forever + +After fix: +7: gre0@NONE: mtu 1500 qdisc noqueue master bond2 state UNKNOWN group default qlen 1000 + link/gre6 2006:70:10::1 peer 2006:70:10::2 permaddr c29e:557a:e9d9:: +8: bond0: mtu 1500 qdisc noqueue state UP group default qlen 1000 + link/gre6 2006:70:10::1 peer 2006:70:10::2 + inet6 fe80::1/64 scope link + valid_lft forever preferred_lft forever + +Reported-by: Liang Li +Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2221438 +Fixes: 872254dd6b1f ("net/bonding: Enable bonding to enslave non ARPHRD_ETHER") +Signed-off-by: Hangbin Liu +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/bonding/bond_main.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c +index 91d84df91123b..576370f89c755 100644 +--- a/drivers/net/bonding/bond_main.c ++++ b/drivers/net/bonding/bond_main.c +@@ -1512,6 +1512,11 @@ static void bond_setup_by_slave(struct net_device *bond_dev, + + memcpy(bond_dev->broadcast, slave_dev->broadcast, + slave_dev->addr_len); ++ ++ if (slave_dev->flags & IFF_POINTOPOINT) { ++ bond_dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST); ++ bond_dev->flags |= (IFF_POINTOPOINT | IFF_NOARP); ++ } + } + + /* On bonding slaves other than the currently active slave, suppress +-- +2.39.2 + diff --git a/queue-6.1/ethernet-atheros-fix-return-value-check-in-atl1e_tso.patch b/queue-6.1/ethernet-atheros-fix-return-value-check-in-atl1e_tso.patch new file mode 100644 index 00000000000..e5f556ad5ad --- /dev/null +++ b/queue-6.1/ethernet-atheros-fix-return-value-check-in-atl1e_tso.patch @@ -0,0 +1,44 @@ +From 798ecdb22b0a0f176814aa24a41aeb9f7bf07217 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jul 2023 22:42:19 +0800 +Subject: ethernet: atheros: fix return value check in atl1e_tso_csum() + +From: Yuanjun Gong + +[ Upstream commit 69a184f7a372aac588babfb0bd681aaed9779f5b ] + +in atl1e_tso_csum, it should check the return value of pskb_trim(), +and return an error code if an unexpected value is returned +by pskb_trim(). + +Fixes: a6a5325239c2 ("atl1e: Atheros L1E Gigabit Ethernet driver") +Signed-off-by: Yuanjun Gong +Reviewed-by: Simon Horman +Link: https://lore.kernel.org/r/20230720144219.39285-1-ruc_gongyuanjun@163.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +index 5db0f3495a32e..5935be190b9e2 100644 +--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c ++++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +@@ -1641,8 +1641,11 @@ static int atl1e_tso_csum(struct atl1e_adapter *adapter, + real_len = (((unsigned char *)ip_hdr(skb) - skb->data) + + ntohs(ip_hdr(skb)->tot_len)); + +- if (real_len < skb->len) +- pskb_trim(skb, real_len); ++ if (real_len < skb->len) { ++ err = pskb_trim(skb, real_len); ++ if (err) ++ return err; ++ } + + hdr_len = skb_tcp_all_headers(skb); + if (unlikely(skb->len == hdr_len)) { +-- +2.39.2 + diff --git a/queue-6.1/i40e-fix-an-null-vs-is_err-bug-for-debugfs_create_di.patch b/queue-6.1/i40e-fix-an-null-vs-is_err-bug-for-debugfs_create_di.patch new file mode 100644 index 00000000000..28d41edad44 --- /dev/null +++ b/queue-6.1/i40e-fix-an-null-vs-is_err-bug-for-debugfs_create_di.patch @@ -0,0 +1,40 @@ +From 02bd550777145be54906651b5a4c7dddc4a446fa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 Jul 2023 09:42:39 +0800 +Subject: i40e: Fix an NULL vs IS_ERR() bug for debugfs_create_dir() + +From: Wang Ming + +[ Upstream commit 043b1f185fb0f3939b7427f634787706f45411c4 ] + +The debugfs_create_dir() function returns error pointers. +It never returns NULL. Most incorrect error checks were fixed, +but the one in i40e_dbg_init() was forgotten. + +Fix the remaining error check. + +Fixes: 02e9c290814c ("i40e: debugfs interface") +Signed-off-by: Wang Ming +Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +index 9954493cd4489..62497f5565c59 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +@@ -1839,7 +1839,7 @@ void i40e_dbg_pf_exit(struct i40e_pf *pf) + void i40e_dbg_init(void) + { + i40e_dbg_root = debugfs_create_dir(i40e_driver_name, NULL); +- if (!i40e_dbg_root) ++ if (IS_ERR(i40e_dbg_root)) + pr_info("init of debugfs failed\n"); + } + +-- +2.39.2 + diff --git a/queue-6.1/iavf-check-for-removal-state-before-iavf_flag_pf_com.patch b/queue-6.1/iavf-check-for-removal-state-before-iavf_flag_pf_com.patch new file mode 100644 index 00000000000..6e105969a9f --- /dev/null +++ b/queue-6.1/iavf-check-for-removal-state-before-iavf_flag_pf_com.patch @@ -0,0 +1,59 @@ +From 323ef8a3dbda598193d5c58e764f5fff1aeed30d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 10 Jul 2023 13:41:28 -0700 +Subject: iavf: check for removal state before IAVF_FLAG_PF_COMMS_FAILED + +From: Jacob Keller + +[ Upstream commit 91896c8acce23d33ed078cffd46a9534b1f82be5 ] + +In iavf_adminq_task(), if the function can't acquire the +adapter->crit_lock, it checks if the driver is removing. If so, it simply +exits without re-enabling the interrupt. This is done to ensure that the +task stops processing as soon as possible once the driver is being removed. + +However, if the IAVF_FLAG_PF_COMMS_FAILED is set, the function checks this +before attempting to acquire the lock. In this case, the function exits +early and re-enables the interrupt. This will happen even if the driver is +already removing. + +Avoid this, by moving the check to after the adapter->crit_lock is +acquired. This way, if the driver is removing, we will not re-enable the +interrupt. + +Fixes: fc2e6b3b132a ("iavf: Rework mutexes for better synchronisation") +Signed-off-by: Jacob Keller +Tested-by: Rafal Romanowski +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/iavf/iavf_main.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c +index 650a969a69a14..22bc57ee24228 100644 +--- a/drivers/net/ethernet/intel/iavf/iavf_main.c ++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c +@@ -3286,9 +3286,6 @@ static void iavf_adminq_task(struct work_struct *work) + u32 val, oldval; + u16 pending; + +- if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) +- goto out; +- + if (!mutex_trylock(&adapter->crit_lock)) { + if (adapter->state == __IAVF_REMOVE) + return; +@@ -3297,6 +3294,9 @@ static void iavf_adminq_task(struct work_struct *work) + goto out; + } + ++ if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) ++ goto unlock; ++ + event.buf_len = IAVF_MAX_AQ_BUF_SIZE; + event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL); + if (!event.msg_buf) +-- +2.39.2 + diff --git a/queue-6.1/iavf-fix-potential-deadlock-on-allocation-failure.patch b/queue-6.1/iavf-fix-potential-deadlock-on-allocation-failure.patch new file mode 100644 index 00000000000..d5f8fb2bedf --- /dev/null +++ b/queue-6.1/iavf-fix-potential-deadlock-on-allocation-failure.patch @@ -0,0 +1,60 @@ +From e9b721e539ac110ea6b6f6e28d8492f58da0ccc0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 10 Jul 2023 13:41:27 -0700 +Subject: iavf: fix potential deadlock on allocation failure + +From: Jacob Keller + +[ Upstream commit a2f054c10bef0b54600ec9cb776508443e941343 ] + +In iavf_adminq_task(), if kzalloc() fails to allocate the event.msg_buf, +the function will exit without releasing the adapter->crit_lock. + +This is unlikely, but if it happens, the next access to that mutex will +deadlock. + +Fix this by moving the unlock to the end of the function, and adding a new +label to allow jumping to the unlock portion of the function exit flow. + +Fixes: fc2e6b3b132a ("iavf: Rework mutexes for better synchronisation") +Signed-off-by: Jacob Keller +Tested-by: Rafal Romanowski +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/iavf/iavf_main.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c +index c1f91c55e1ca7..650a969a69a14 100644 +--- a/drivers/net/ethernet/intel/iavf/iavf_main.c ++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c +@@ -3300,7 +3300,7 @@ static void iavf_adminq_task(struct work_struct *work) + event.buf_len = IAVF_MAX_AQ_BUF_SIZE; + event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL); + if (!event.msg_buf) +- goto out; ++ goto unlock; + + do { + ret = iavf_clean_arq_element(hw, &event, &pending); +@@ -3315,7 +3315,6 @@ static void iavf_adminq_task(struct work_struct *work) + if (pending != 0) + memset(event.msg_buf, 0, IAVF_MAX_AQ_BUF_SIZE); + } while (pending); +- mutex_unlock(&adapter->crit_lock); + + if (iavf_is_reset_in_progress(adapter)) + goto freedom; +@@ -3359,6 +3358,8 @@ static void iavf_adminq_task(struct work_struct *work) + + freedom: + kfree(event.msg_buf); ++unlock: ++ mutex_unlock(&adapter->crit_lock); + out: + /* re-enable Admin queue interrupt cause */ + iavf_misc_irq_enable(adapter); +-- +2.39.2 + diff --git a/queue-6.1/ice-fix-memory-management-in-ice_ethtool_fdir.c.patch b/queue-6.1/ice-fix-memory-management-in-ice_ethtool_fdir.c.patch new file mode 100644 index 00000000000..8c9b1fd7cc2 --- /dev/null +++ b/queue-6.1/ice-fix-memory-management-in-ice_ethtool_fdir.c.patch @@ -0,0 +1,103 @@ +From b9f53fbc3cd86e39a6668abc1cccc5b7e9340e8e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 08:58:54 -0700 +Subject: ice: Fix memory management in ice_ethtool_fdir.c + +From: Jedrzej Jagielski + +[ Upstream commit a3336056504d780590ac6d6ac94fbba829994594 ] + +Fix ethtool FDIR logic to not use memory after its release. +In the ice_ethtool_fdir.c file there are 2 spots where code can +refer to pointers which may be missing. + +In the ice_cfg_fdir_xtrct_seq() function seg may be freed but +even then may be still used by memcpy(&tun_seg[1], seg, sizeof(*seg)). + +In the ice_add_fdir_ethtool() function struct ice_fdir_fltr *input +may first fail to be added via ice_fdir_update_list_entry() but then +may be deleted by ice_fdir_update_list_entry. + +Terminate in both cases when the returned value of the previous +operation is other than 0, free memory and don't use it anymore. + +Reported-by: Michal Schmidt +Link: https://bugzilla.redhat.com/show_bug.cgi?id=2208423 +Fixes: cac2a27cd9ab ("ice: Support IPv4 Flow Director filters") +Reviewed-by: Przemek Kitszel +Signed-off-by: Jedrzej Jagielski +Reviewed-by: Leon Romanovsky +Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) +Signed-off-by: Tony Nguyen +Link: https://lore.kernel.org/r/20230721155854.1292805-1-anthony.l.nguyen@intel.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + .../net/ethernet/intel/ice/ice_ethtool_fdir.c | 26 ++++++++++--------- + 1 file changed, 14 insertions(+), 12 deletions(-) + +diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c +index ead6d50fc0adc..8c6e13f87b7d3 100644 +--- a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c ++++ b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c +@@ -1281,16 +1281,21 @@ ice_cfg_fdir_xtrct_seq(struct ice_pf *pf, struct ethtool_rx_flow_spec *fsp, + ICE_FLOW_FLD_OFF_INVAL); + } + +- /* add filter for outer headers */ + fltr_idx = ice_ethtool_flow_to_fltr(fsp->flow_type & ~FLOW_EXT); ++ ++ assign_bit(fltr_idx, hw->fdir_perfect_fltr, perfect_filter); ++ ++ /* add filter for outer headers */ + ret = ice_fdir_set_hw_fltr_rule(pf, seg, fltr_idx, + ICE_FD_HW_SEG_NON_TUN); +- if (ret == -EEXIST) +- /* Rule already exists, free memory and continue */ +- devm_kfree(dev, seg); +- else if (ret) ++ if (ret == -EEXIST) { ++ /* Rule already exists, free memory and count as success */ ++ ret = 0; ++ goto err_exit; ++ } else if (ret) { + /* could not write filter, free memory */ + goto err_exit; ++ } + + /* make tunneled filter HW entries if possible */ + memcpy(&tun_seg[1], seg, sizeof(*seg)); +@@ -1305,18 +1310,13 @@ ice_cfg_fdir_xtrct_seq(struct ice_pf *pf, struct ethtool_rx_flow_spec *fsp, + devm_kfree(dev, tun_seg); + } + +- if (perfect_filter) +- set_bit(fltr_idx, hw->fdir_perfect_fltr); +- else +- clear_bit(fltr_idx, hw->fdir_perfect_fltr); +- + return ret; + + err_exit: + devm_kfree(dev, tun_seg); + devm_kfree(dev, seg); + +- return -EOPNOTSUPP; ++ return ret; + } + + /** +@@ -1914,7 +1914,9 @@ int ice_add_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd) + input->comp_report = ICE_FXD_FLTR_QW0_COMP_REPORT_SW_FAIL; + + /* input struct is added to the HW filter list */ +- ice_fdir_update_list_entry(pf, input, fsp->location); ++ ret = ice_fdir_update_list_entry(pf, input, fsp->location); ++ if (ret) ++ goto release_lock; + + ret = ice_fdir_write_all_fltr(pf, input, true); + if (ret) +-- +2.39.2 + diff --git a/queue-6.1/igc-fix-kernel-panic-during-ndo_tx_timeout-callback.patch b/queue-6.1/igc-fix-kernel-panic-during-ndo_tx_timeout-callback.patch new file mode 100644 index 00000000000..42b4e2884f2 --- /dev/null +++ b/queue-6.1/igc-fix-kernel-panic-during-ndo_tx_timeout-callback.patch @@ -0,0 +1,390 @@ +From 046e308ad3cd95c93717af63aa6adc2588cc4e4d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Jul 2023 09:12:50 -0700 +Subject: igc: Fix Kernel Panic during ndo_tx_timeout callback + +From: Muhammad Husaini Zulkifli + +[ Upstream commit d4a7ce642100765119a872d4aba1bf63e3a22c8a ] + +The Xeon validation group has been carrying out some loaded tests +with various HW configurations, and they have seen some transmit +queue time out happening during the test. This will cause the +reset adapter function to be called by igc_tx_timeout(). +Similar race conditions may arise when the interface is being brought +down and up in igc_reinit_locked(), an interrupt being generated, and +igc_clean_tx_irq() being called to complete the TX. + +When the igc_tx_timeout() function is invoked, this patch will turn +off all TX ring HW queues during igc_down() process. TX ring HW queues +will be activated again during the igc_configure_tx_ring() process +when performing the igc_up() procedure later. + +This patch also moved existing igc_disable_tx_ring_hw() to avoid using +forward declaration. + +Kernel trace: +[ 7678.747813] ------------[ cut here ]------------ +[ 7678.757914] NETDEV WATCHDOG: enp1s0 (igc): transmit queue 2 timed out +[ 7678.770117] WARNING: CPU: 0 PID: 13 at net/sched/sch_generic.c:525 dev_watchdog+0x1ae/0x1f0 +[ 7678.784459] Modules linked in: xt_conntrack nft_chain_nat xt_MASQUERADE xt_addrtype nft_compat +nf_tables nfnetlink br_netfilter bridge stp llc overlay dm_mod emrcha(PO) emriio(PO) rktpm(PO) +cegbuf_mod(PO) patch_update(PO) se(PO) sgx_tgts(PO) mktme(PO) keylocker(PO) svtdx(PO) svfs_pci_hotplug(PO) +vtd_mod(PO) davemem(PO) svmabort(PO) svindexio(PO) usbx2(PO) ehci_sched(PO) svheartbeat(PO) ioapic(PO) +sv8259(PO) svintr(PO) lt(PO) pcierootport(PO) enginefw_mod(PO) ata(PO) smbus(PO) spiflash_cdf(PO) arden(PO) +dsa_iax(PO) oobmsm_punit(PO) cpm(PO) svkdb(PO) ebg_pch(PO) pch(PO) sviotargets(PO) svbdf(PO) svmem(PO) +svbios(PO) dram(PO) svtsc(PO) targets(PO) superio(PO) svkernel(PO) cswitch(PO) mcf(PO) pentiumIII_mod(PO) +fs_svfs(PO) mdevdefdb(PO) svfs_os_services(O) ixgbe mdio mdio_devres libphy emeraldrapids_svdefs(PO) +regsupport(O) libnvdimm nls_cp437 snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_intel +snd_intel_dspcfg snd_hda_codec snd_hwdep x86_pkg_temp_thermal snd_hda_core snd_pcm snd_timer isst_if_mbox_pci +[ 7678.784496] input_leds isst_if_mmio sg snd isst_if_common soundcore wmi button sad9(O) drm fuse backlight +configfs efivarfs ip_tables x_tables vmd sdhci led_class rtl8150 r8152 hid_generic pegasus mmc_block usbhid +mmc_core hid megaraid_sas ixgb igb i2c_algo_bit ice i40e hpsa scsi_transport_sas e1000e e1000 e100 ax88179_178a +usbnet xhci_pci sd_mod xhci_hcd t10_pi crc32c_intel crc64_rocksoft igc crc64 crc_t10dif usbcore +crct10dif_generic ptp crct10dif_common usb_common pps_core +[ 7679.200403] RIP: 0010:dev_watchdog+0x1ae/0x1f0 +[ 7679.210201] Code: 28 e9 53 ff ff ff 4c 89 e7 c6 05 06 42 b9 00 01 e8 17 d1 fb ff 44 89 e9 4c +89 e6 48 c7 c7 40 ad fb 81 48 89 c2 e8 52 62 82 ff <0f> 0b e9 72 ff ff ff 65 8b 05 80 7d 7c 7e +89 c0 48 0f a3 05 0a c1 +[ 7679.245438] RSP: 0018:ffa00000001f7d90 EFLAGS: 00010282 +[ 7679.256021] RAX: 0000000000000000 RBX: ff11000109938440 RCX: 0000000000000000 +[ 7679.268710] RDX: ff11000361e26cd8 RSI: ff11000361e1b880 RDI: ff11000361e1b880 +[ 7679.281314] RBP: ffa00000001f7da8 R08: ff1100035f8fffe8 R09: 0000000000027ffb +[ 7679.293840] R10: 0000000000001f0a R11: ff1100035f840000 R12: ff11000109938000 +[ 7679.306276] R13: 0000000000000002 R14: dead000000000122 R15: ffa00000001f7e18 +[ 7679.318648] FS: 0000000000000000(0000) GS:ff11000361e00000(0000) knlGS:0000000000000000 +[ 7679.332064] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 7679.342757] CR2: 00007ffff7fca168 CR3: 000000013b08a006 CR4: 0000000000471ef8 +[ 7679.354984] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +[ 7679.367207] DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 +[ 7679.379370] PKRU: 55555554 +[ 7679.386446] Call Trace: +[ 7679.393152] +[ 7679.399363] ? __pfx_dev_watchdog+0x10/0x10 +[ 7679.407870] call_timer_fn+0x31/0x110 +[ 7679.415698] expire_timers+0xb2/0x120 +[ 7679.423403] run_timer_softirq+0x179/0x1e0 +[ 7679.431532] ? __schedule+0x2b1/0x820 +[ 7679.439078] __do_softirq+0xd1/0x295 +[ 7679.446426] ? __pfx_smpboot_thread_fn+0x10/0x10 +[ 7679.454867] run_ksoftirqd+0x22/0x30 +[ 7679.462058] smpboot_thread_fn+0xb7/0x160 +[ 7679.469670] kthread+0xcd/0xf0 +[ 7679.476097] ? __pfx_kthread+0x10/0x10 +[ 7679.483211] ret_from_fork+0x29/0x50 +[ 7679.490047] +[ 7679.495204] ---[ end trace 0000000000000000 ]--- +[ 7679.503179] igc 0000:01:00.0 enp1s0: Register Dump +[ 7679.511230] igc 0000:01:00.0 enp1s0: Register Name Value +[ 7679.519892] igc 0000:01:00.0 enp1s0: CTRL 181c0641 +[ 7679.528782] igc 0000:01:00.0 enp1s0: STATUS 40280683 +[ 7679.537551] igc 0000:01:00.0 enp1s0: CTRL_EXT 10000040 +[ 7679.546284] igc 0000:01:00.0 enp1s0: MDIC 180a3800 +[ 7679.554942] igc 0000:01:00.0 enp1s0: ICR 00000081 +[ 7679.563503] igc 0000:01:00.0 enp1s0: RCTL 04408022 +[ 7679.571963] igc 0000:01:00.0 enp1s0: RDLEN[0-3] 00001000 00001000 00001000 00001000 +[ 7679.583075] igc 0000:01:00.0 enp1s0: RDH[0-3] 00000068 000000b6 0000000f 00000031 +[ 7679.594162] igc 0000:01:00.0 enp1s0: RDT[0-3] 00000066 000000b2 0000000e 00000030 +[ 7679.605174] igc 0000:01:00.0 enp1s0: RXDCTL[0-3] 02040808 02040808 02040808 02040808 +[ 7679.616196] igc 0000:01:00.0 enp1s0: RDBAL[0-3] 1bb7c000 1bb7f000 1bb82000 0ef33000 +[ 7679.627242] igc 0000:01:00.0 enp1s0: RDBAH[0-3] 00000001 00000001 00000001 00000001 +[ 7679.638256] igc 0000:01:00.0 enp1s0: TCTL a503f0fa +[ 7679.646607] igc 0000:01:00.0 enp1s0: TDBAL[0-3] 2ba4a000 1bb6f000 1bb74000 1bb79000 +[ 7679.657609] igc 0000:01:00.0 enp1s0: TDBAH[0-3] 00000001 00000001 00000001 00000001 +[ 7679.668551] igc 0000:01:00.0 enp1s0: TDLEN[0-3] 00001000 00001000 00001000 00001000 +[ 7679.679470] igc 0000:01:00.0 enp1s0: TDH[0-3] 000000a7 0000002d 000000bf 000000d9 +[ 7679.690406] igc 0000:01:00.0 enp1s0: TDT[0-3] 000000a7 0000002d 000000bf 000000d9 +[ 7679.701264] igc 0000:01:00.0 enp1s0: TXDCTL[0-3] 02100108 02100108 02100108 02100108 +[ 7679.712123] igc 0000:01:00.0 enp1s0: Reset adapter +[ 7683.085967] igc 0000:01:00.0 enp1s0: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX +[ 8086.945561] ------------[ cut here ]------------ +Entering kdb (current=0xffffffff8220b200, pid 0) on processor 0 +Oops: (null) due to oops @ 0xffffffff81573888 +RIP: 0010:dql_completed+0x148/0x160 +Code: c9 00 48 89 57 58 e9 46 ff ff ff 45 85 e4 41 0f 95 c4 41 39 db 0f 95 +c1 41 84 cc 74 05 45 85 ed 78 0a 44 89 c1 e9 27 ff ff ff <0f> 0b 01 f6 44 89 +c1 29 f1 0f 48 ca eb 8c cc cc cc cc cc cc cc cc +RSP: 0018:ffa0000000003e00 EFLAGS: 00010287 +RAX: 000000000000006c RBX: ffa0000003eb0f78 RCX: ff11000109938000 +RDX: 0000000000000003 RSI: 0000000000000160 RDI: ff110001002e9480 +RBP: ffa0000000003ed8 R08: ff110001002e93c0 R09: ffa0000000003d28 +R10: 0000000000007cc0 R11: 0000000000007c54 R12: 00000000ffffffd9 +R13: ff1100037039cb00 R14: 00000000ffffffd9 R15: ff1100037039c048 +FS: 0000000000000000(0000) GS:ff11000361e00000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 00007ffff7fca168 CR3: 000000013b08a003 CR4: 0000000000471ef8 +DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 +PKRU: 55555554 +Call Trace: + + ? igc_poll+0x1a9/0x14d0 [igc] + __napi_poll+0x2e/0x1b0 + net_rx_action+0x126/0x250 + __do_softirq+0xd1/0x295 + irq_exit_rcu+0xc5/0xf0 + common_interrupt+0x86/0xa0 + + + asm_common_interrupt+0x27/0x40 +RIP: 0010:cpuidle_enter_state+0xd3/0x3e0 +Code: 73 f1 ff ff 49 89 c6 8b 05 e2 ca a7 00 85 c0 0f 8f b3 02 00 00 31 ff e8 1b +de 75 ff 80 7d d7 00 0f 85 cd 01 00 00 fb 45 85 ff <0f> 88 fd 00 00 00 49 63 cf +4c 2b 75 c8 48 8d 04 49 48 89 ca 48 8d +RSP: 0018:ffffffff82203df0 EFLAGS: 00000202 +RAX: ff11000361e2a200 RBX: 0000000000000002 RCX: 000000000000001f +RDX: 0000000000000000 RSI: 000000003cf3cf3d RDI: 0000000000000000 +RBP: ffffffff82203e28 R08: 0000075ae38471c8 R09: 0000000000000018 +R10: 000000000000031a R11: ffffffff8238dca0 R12: ffd1ffffff200000 +R13: ffffffff8238dca0 R14: 0000075ae38471c8 R15: 0000000000000002 + cpuidle_enter+0x2e/0x50 + call_cpuidle+0x23/0x40 + do_idle+0x1be/0x220 + cpu_startup_entry+0x20/0x30 + rest_init+0xb5/0xc0 + arch_call_rest_init+0xe/0x30 + start_kernel+0x448/0x760 + x86_64_start_kernel+0x109/0x150 + secondary_startup_64_no_verify+0xe0/0xeb + +more> +[0]kdb> + +[0]kdb> +[0]kdb> go +Catastrophic error detected +kdb_continue_catastrophic=0, type go a second time if you really want to +continue +[0]kdb> go +Catastrophic error detected +kdb_continue_catastrophic=0, attempting to continue +[ 8086.955689] refcount_t: underflow; use-after-free. +[ 8086.955697] WARNING: CPU: 0 PID: 0 at lib/refcount.c:28 refcount_warn_saturate+0xc2/0x110 +[ 8086.955706] Modules linked in: xt_conntrack nft_chain_nat xt_MASQUERADE xt_addrtype nft_compat +nf_tables nfnetlink br_netfilter bridge stp llc overlay dm_mod emrcha(PO) emriio(PO) rktpm(PO) +cegbuf_mod(PO) patch_update(PO) se(PO) sgx_tgts(PO) mktme(PO) keylocker(PO) svtdx(PO) +svfs_pci_hotplug(PO) vtd_mod(PO) davemem(PO) svmabort(PO) svindexio(PO) usbx2(PO) ehci_sched(PO) +svheartbeat(PO) ioapic(PO) sv8259(PO) svintr(PO) lt(PO) pcierootport(PO) enginefw_mod(PO) ata(PO) +smbus(PO) spiflash_cdf(PO) arden(PO) dsa_iax(PO) oobmsm_punit(PO) cpm(PO) svkdb(PO) ebg_pch(PO) +pch(PO) sviotargets(PO) svbdf(PO) svmem(PO) svbios(PO) dram(PO) svtsc(PO) targets(PO) superio(PO) +svkernel(PO) cswitch(PO) mcf(PO) pentiumIII_mod(PO) fs_svfs(PO) mdevdefdb(PO) svfs_os_services(O) +ixgbe mdio mdio_devres libphy emeraldrapids_svdefs(PO) regsupport(O) libnvdimm nls_cp437 +snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_intel_dspcfg +snd_hda_codec snd_hwdep x86_pkg_temp_thermal snd_hda_core snd_pcm snd_timer isst_if_mbox_pci +[ 8086.955751] input_leds isst_if_mmio sg snd isst_if_common soundcore wmi button sad9(O) drm +fuse backlight configfs efivarfs ip_tables x_tables vmd sdhci led_class rtl8150 r8152 hid_generic +pegasus mmc_block usbhid mmc_core hid megaraid_sas ixgb igb i2c_algo_bit ice i40e hpsa +scsi_transport_sas e1000e e1000 e100 ax88179_178a usbnet xhci_pci sd_mod xhci_hcd t10_pi +crc32c_intel crc64_rocksoft igc crc64 crc_t10dif usbcore crct10dif_generic ptp crct10dif_common +usb_common pps_core +[ 8086.955784] RIP: 0010:refcount_warn_saturate+0xc2/0x110 +[ 8086.955788] Code: 01 e8 82 e7 b4 ff 0f 0b 5d c3 cc cc cc cc 80 3d 68 c6 eb 00 00 75 81 +48 c7 c7 a0 87 f6 81 c6 05 58 c6 eb 00 01 e8 5e e7 b4 ff <0f> 0b 5d c3 cc cc cc cc 80 3d +42 c6 eb 00 00 0f 85 59 ff ff ff 48 +[ 8086.955790] RSP: 0018:ffa0000000003da0 EFLAGS: 00010286 +[ 8086.955793] RAX: 0000000000000000 RBX: ff1100011da40ee0 RCX: ff11000361e1b888 +[ 8086.955794] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ff11000361e1b880 +[ 8086.955795] RBP: ffa0000000003da0 R08: 80000000ffff9f45 R09: ffa0000000003d28 +[ 8086.955796] R10: ff1100035f840000 R11: 0000000000000028 R12: ff11000319ff8000 +[ 8086.955797] R13: ff1100011bb79d60 R14: 00000000ffffffd6 R15: ff1100037039cb00 +[ 8086.955798] FS: 0000000000000000(0000) GS:ff11000361e00000(0000) knlGS:0000000000000000 +[ 8086.955800] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 8086.955801] CR2: 00007ffff7fca168 CR3: 000000013b08a003 CR4: 0000000000471ef8 +[ 8086.955803] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +[ 8086.955803] DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 +[ 8086.955804] PKRU: 55555554 +[ 8086.955805] Call Trace: +[ 8086.955806] +[ 8086.955808] tcp_wfree+0x112/0x130 +[ 8086.955814] skb_release_head_state+0x24/0xa0 +[ 8086.955818] napi_consume_skb+0x9c/0x160 +[ 8086.955821] igc_poll+0x5d8/0x14d0 [igc] +[ 8086.955835] __napi_poll+0x2e/0x1b0 +[ 8086.955839] net_rx_action+0x126/0x250 +[ 8086.955843] __do_softirq+0xd1/0x295 +[ 8086.955846] irq_exit_rcu+0xc5/0xf0 +[ 8086.955851] common_interrupt+0x86/0xa0 +[ 8086.955857] +[ 8086.955857] +[ 8086.955858] asm_common_interrupt+0x27/0x40 +[ 8086.955862] RIP: 0010:cpuidle_enter_state+0xd3/0x3e0 +[ 8086.955866] Code: 73 f1 ff ff 49 89 c6 8b 05 e2 ca a7 00 85 c0 0f 8f b3 02 00 00 31 ff e8 +1b de 75 ff 80 7d d7 00 0f 85 cd 01 00 00 fb 45 85 ff <0f> 88 fd 00 00 00 49 63 cf 4c 2b 75 +c8 48 8d 04 49 48 89 ca 48 8d +[ 8086.955867] RSP: 0018:ffffffff82203df0 EFLAGS: 00000202 +[ 8086.955869] RAX: ff11000361e2a200 RBX: 0000000000000002 RCX: 000000000000001f +[ 8086.955870] RDX: 0000000000000000 RSI: 000000003cf3cf3d RDI: 0000000000000000 +[ 8086.955871] RBP: ffffffff82203e28 R08: 0000075ae38471c8 R09: 0000000000000018 +[ 8086.955872] R10: 000000000000031a R11: ffffffff8238dca0 R12: ffd1ffffff200000 +[ 8086.955873] R13: ffffffff8238dca0 R14: 0000075ae38471c8 R15: 0000000000000002 +[ 8086.955875] cpuidle_enter+0x2e/0x50 +[ 8086.955880] call_cpuidle+0x23/0x40 +[ 8086.955884] do_idle+0x1be/0x220 +[ 8086.955887] cpu_startup_entry+0x20/0x30 +[ 8086.955889] rest_init+0xb5/0xc0 +[ 8086.955892] arch_call_rest_init+0xe/0x30 +[ 8086.955895] start_kernel+0x448/0x760 +[ 8086.955898] x86_64_start_kernel+0x109/0x150 +[ 8086.955900] secondary_startup_64_no_verify+0xe0/0xeb +[ 8086.955904] +[ 8086.955904] ---[ end trace 0000000000000000 ]--- +[ 8086.955912] ------------[ cut here ]------------ +[ 8086.955913] kernel BUG at lib/dynamic_queue_limits.c:27! +[ 8086.955918] invalid opcode: 0000 [#1] SMP +[ 8086.955922] RIP: 0010:dql_completed+0x148/0x160 +[ 8086.955925] Code: c9 00 48 89 57 58 e9 46 ff ff ff 45 85 e4 41 0f 95 c4 41 39 db +0f 95 c1 41 84 cc 74 05 45 85 ed 78 0a 44 89 c1 e9 27 ff ff ff <0f> 0b 01 f6 44 89 +c1 29 f1 0f 48 ca eb 8c cc cc cc cc cc cc cc cc +[ 8086.955927] RSP: 0018:ffa0000000003e00 EFLAGS: 00010287 +[ 8086.955928] RAX: 000000000000006c RBX: ffa0000003eb0f78 RCX: ff11000109938000 +[ 8086.955929] RDX: 0000000000000003 RSI: 0000000000000160 RDI: ff110001002e9480 +[ 8086.955930] RBP: ffa0000000003ed8 R08: ff110001002e93c0 R09: ffa0000000003d28 +[ 8086.955931] R10: 0000000000007cc0 R11: 0000000000007c54 R12: 00000000ffffffd9 +[ 8086.955932] R13: ff1100037039cb00 R14: 00000000ffffffd9 R15: ff1100037039c048 +[ 8086.955933] FS: 0000000000000000(0000) GS:ff11000361e00000(0000) knlGS:0000000000000000 +[ 8086.955934] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 8086.955935] CR2: 00007ffff7fca168 CR3: 000000013b08a003 CR4: 0000000000471ef8 +[ 8086.955936] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +[ 8086.955937] DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 +[ 8086.955938] PKRU: 55555554 +[ 8086.955939] Call Trace: +[ 8086.955939] +[ 8086.955940] ? igc_poll+0x1a9/0x14d0 [igc] +[ 8086.955949] __napi_poll+0x2e/0x1b0 +[ 8086.955952] net_rx_action+0x126/0x250 +[ 8086.955956] __do_softirq+0xd1/0x295 +[ 8086.955958] irq_exit_rcu+0xc5/0xf0 +[ 8086.955961] common_interrupt+0x86/0xa0 +[ 8086.955964] +[ 8086.955965] +[ 8086.955965] asm_common_interrupt+0x27/0x40 +[ 8086.955968] RIP: 0010:cpuidle_enter_state+0xd3/0x3e0 +[ 8086.955971] Code: 73 f1 ff ff 49 89 c6 8b 05 e2 ca a7 00 85 c0 0f 8f b3 02 00 00 +31 ff e8 1b de 75 ff 80 7d d7 00 0f 85 cd 01 00 00 fb 45 85 ff <0f> 88 fd 00 00 00 +49 63 cf 4c 2b 75 c8 48 8d 04 49 48 89 ca 48 8d +[ 8086.955972] RSP: 0018:ffffffff82203df0 EFLAGS: 00000202 +[ 8086.955973] RAX: ff11000361e2a200 RBX: 0000000000000002 RCX: 000000000000001f +[ 8086.955974] RDX: 0000000000000000 RSI: 000000003cf3cf3d RDI: 0000000000000000 +[ 8086.955974] RBP: ffffffff82203e28 R08: 0000075ae38471c8 R09: 0000000000000018 +[ 8086.955975] R10: 000000000000031a R11: ffffffff8238dca0 R12: ffd1ffffff200000 +[ 8086.955976] R13: ffffffff8238dca0 R14: 0000075ae38471c8 R15: 0000000000000002 +[ 8086.955978] cpuidle_enter+0x2e/0x50 +[ 8086.955981] call_cpuidle+0x23/0x40 +[ 8086.955984] do_idle+0x1be/0x220 +[ 8086.955985] cpu_startup_entry+0x20/0x30 +[ 8086.955987] rest_init+0xb5/0xc0 +[ 8086.955990] arch_call_rest_init+0xe/0x30 +[ 8086.955992] start_kernel+0x448/0x760 +[ 8086.955994] x86_64_start_kernel+0x109/0x150 +[ 8086.955996] secondary_startup_64_no_verify+0xe0/0xeb +[ 8086.955998] +[ 8086.955999] Modules linked in: xt_conntrack nft_chain_nat xt_MASQUERADE xt_addrtype +nft_compat nf_tables nfnetlink br_netfilter bridge stp llc overlay dm_mod emrcha(PO) emriio(PO) +rktpm(PO) cegbuf_mod(PO) patch_update(PO) se(PO) sgx_tgts(PO) mktme(PO) keylocker(PO) svtdx(PO) +svfs_pci_hotplug(PO) vtd_mod(PO) davemem(PO) svmabort(PO) svindexio(PO) usbx2(PO) ehci_sched(PO) +svheartbeat(PO) ioapic(PO) sv8259(PO) svintr(PO) lt(PO) pcierootport(PO) enginefw_mod(PO) ata(PO) +smbus(PO) spiflash_cdf(PO) arden(PO) dsa_iax(PO) oobmsm_punit(PO) cpm(PO) svkdb(PO) ebg_pch(PO) +pch(PO) sviotargets(PO) svbdf(PO) svmem(PO) svbios(PO) dram(PO) svtsc(PO) targets(PO) superio(PO) +svkernel(PO) cswitch(PO) mcf(PO) pentiumIII_mod(PO) fs_svfs(PO) mdevdefdb(PO) svfs_os_services(O) +ixgbe mdio mdio_devres libphy emeraldrapids_svdefs(PO) regsupport(O) libnvdimm nls_cp437 +snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_intel_dspcfg +snd_hda_codec snd_hwdep x86_pkg_temp_thermal snd_hda_core snd_pcm snd_timer isst_if_mbox_pci +[ 8086.956029] input_leds isst_if_mmio sg snd isst_if_common soundcore wmi button sad9(O) drm +fuse backlight configfs efivarfs ip_tables x_tables vmd sdhci led_class rtl8150 r8152 hid_generic +pegasus mmc_block usbhid mmc_core hid megaraid_sas ixgb igb i2c_algo_bit ice i40e hpsa +scsi_transport_sas e1000e e1000 e100 ax88179_178a usbnet xhci_pci sd_mod xhci_hcd t10_pi +crc32c_intel crc64_rocksoft igc crc64 crc_t10dif usbcore crct10dif_generic ptp crct10dif_common +usb_common pps_core +[16762.543675] INFO: NMI handler (kgdb_nmi_handler) took too long to run: 8675587.593 msecs +[16762.543678] INFO: NMI handler (kgdb_nmi_handler) took too long to run: 8675587.595 msecs +[16762.543673] INFO: NMI handler (kgdb_nmi_handler) took too long to run: 8675587.495 msecs +[16762.543679] INFO: NMI handler (kgdb_nmi_handler) took too long to run: 8675587.599 msecs +[16762.543678] INFO: NMI handler (kgdb_nmi_handler) took too long to run: 8675587.598 msecs +[16762.543690] INFO: NMI handler (kgdb_nmi_handler) took too long to run: 8675587.605 msecs +[16762.543684] INFO: NMI handler (kgdb_nmi_handler) took too long to run: 8675587.599 msecs +[16762.543693] INFO: NMI handler (kgdb_nmi_handler) took too long to run: 8675587.613 msecs +[16762.543784] ---[ end trace 0000000000000000 ]--- +[16762.849099] RIP: 0010:dql_completed+0x148/0x160 +PANIC: Fatal exception in interrupt + +Fixes: 9b275176270e ("igc: Add ndo_tx_timeout support") +Tested-by: Alejandra Victoria Alcaraz +Signed-off-by: Muhammad Husaini Zulkifli +Acked-by: Sasha Neftin +Tested-by: Naama Meir +Signed-off-by: Tony Nguyen +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/igc/igc_main.c | 40 ++++++++++++++++------- + 1 file changed, 28 insertions(+), 12 deletions(-) + +diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c +index 2e091a4a065e7..d877dc0f87f71 100644 +--- a/drivers/net/ethernet/intel/igc/igc_main.c ++++ b/drivers/net/ethernet/intel/igc/igc_main.c +@@ -317,6 +317,33 @@ static void igc_clean_all_tx_rings(struct igc_adapter *adapter) + igc_clean_tx_ring(adapter->tx_ring[i]); + } + ++static void igc_disable_tx_ring_hw(struct igc_ring *ring) ++{ ++ struct igc_hw *hw = &ring->q_vector->adapter->hw; ++ u8 idx = ring->reg_idx; ++ u32 txdctl; ++ ++ txdctl = rd32(IGC_TXDCTL(idx)); ++ txdctl &= ~IGC_TXDCTL_QUEUE_ENABLE; ++ txdctl |= IGC_TXDCTL_SWFLUSH; ++ wr32(IGC_TXDCTL(idx), txdctl); ++} ++ ++/** ++ * igc_disable_all_tx_rings_hw - Disable all transmit queue operation ++ * @adapter: board private structure ++ */ ++static void igc_disable_all_tx_rings_hw(struct igc_adapter *adapter) ++{ ++ int i; ++ ++ for (i = 0; i < adapter->num_tx_queues; i++) { ++ struct igc_ring *tx_ring = adapter->tx_ring[i]; ++ ++ igc_disable_tx_ring_hw(tx_ring); ++ } ++} ++ + /** + * igc_setup_tx_resources - allocate Tx resources (Descriptors) + * @tx_ring: tx descriptor ring (for a specific queue) to setup +@@ -5026,6 +5053,7 @@ void igc_down(struct igc_adapter *adapter) + /* clear VLAN promisc flag so VFTA will be updated if necessary */ + adapter->flags &= ~IGC_FLAG_VLAN_PROMISC; + ++ igc_disable_all_tx_rings_hw(adapter); + igc_clean_all_tx_rings(adapter); + igc_clean_all_rx_rings(adapter); + } +@@ -7124,18 +7152,6 @@ void igc_enable_rx_ring(struct igc_ring *ring) + igc_alloc_rx_buffers(ring, igc_desc_unused(ring)); + } + +-static void igc_disable_tx_ring_hw(struct igc_ring *ring) +-{ +- struct igc_hw *hw = &ring->q_vector->adapter->hw; +- u8 idx = ring->reg_idx; +- u32 txdctl; +- +- txdctl = rd32(IGC_TXDCTL(idx)); +- txdctl &= ~IGC_TXDCTL_QUEUE_ENABLE; +- txdctl |= IGC_TXDCTL_SWFLUSH; +- wr32(IGC_TXDCTL(idx), txdctl); +-} +- + void igc_disable_tx_ring(struct igc_ring *ring) + { + igc_disable_tx_ring_hw(ring); +-- +2.39.2 + diff --git a/queue-6.1/ipv6-addrconf-fix-bug-where-deleting-a-mngtmpaddr-ca.patch b/queue-6.1/ipv6-addrconf-fix-bug-where-deleting-a-mngtmpaddr-ca.patch new file mode 100644 index 00000000000..be627f3490e --- /dev/null +++ b/queue-6.1/ipv6-addrconf-fix-bug-where-deleting-a-mngtmpaddr-ca.patch @@ -0,0 +1,96 @@ +From 65da257def2c0c927b8590bf0f6fd410198d4961 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jul 2023 09:00:22 -0700 +Subject: ipv6 addrconf: fix bug where deleting a mngtmpaddr can create a new + temporary address +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Maciej Żenczykowski + +[ Upstream commit 69172f0bcb6a09110c5d2a6d792627f5095a9018 ] + +currently on 6.4 net/main: + + # ip link add dummy1 type dummy + # echo 1 > /proc/sys/net/ipv6/conf/dummy1/use_tempaddr + # ip link set dummy1 up + # ip -6 addr add 2000::1/64 mngtmpaddr dev dummy1 + # ip -6 addr show dev dummy1 + + 11: dummy1: mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000 + inet6 2000::44f3:581c:8ca:3983/64 scope global temporary dynamic + valid_lft 604800sec preferred_lft 86172sec + inet6 2000::1/64 scope global mngtmpaddr + valid_lft forever preferred_lft forever + inet6 fe80::e8a8:a6ff:fed5:56d4/64 scope link + valid_lft forever preferred_lft forever + + # ip -6 addr del 2000::44f3:581c:8ca:3983/64 dev dummy1 + + (can wait a few seconds if you want to, the above delete isn't [directly] the problem) + + # ip -6 addr show dev dummy1 + + 11: dummy1: mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000 + inet6 2000::1/64 scope global mngtmpaddr + valid_lft forever preferred_lft forever + inet6 fe80::e8a8:a6ff:fed5:56d4/64 scope link + valid_lft forever preferred_lft forever + + # ip -6 addr del 2000::1/64 mngtmpaddr dev dummy1 + # ip -6 addr show dev dummy1 + + 11: dummy1: mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000 + inet6 2000::81c9:56b7:f51a:b98f/64 scope global temporary dynamic + valid_lft 604797sec preferred_lft 86169sec + inet6 fe80::e8a8:a6ff:fed5:56d4/64 scope link + valid_lft forever preferred_lft forever + +This patch prevents this new 'global temporary dynamic' address from being +created by the deletion of the related (same subnet prefix) 'mngtmpaddr' +(which is triggered by there already being no temporary addresses). + +Cc: Jiri Pirko +Fixes: 53bd67491537 ("ipv6 addrconf: introduce IFA_F_MANAGETEMPADDR to tell kernel to manage temporary addresses") +Reported-by: Xiao Ma +Signed-off-by: Maciej Żenczykowski +Reviewed-by: David Ahern +Link: https://lore.kernel.org/r/20230720160022.1887942-1-maze@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv6/addrconf.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c +index 51bfc74805ecf..48a6486951cd6 100644 +--- a/net/ipv6/addrconf.c ++++ b/net/ipv6/addrconf.c +@@ -2561,12 +2561,18 @@ static void manage_tempaddrs(struct inet6_dev *idev, + ipv6_ifa_notify(0, ift); + } + +- if ((create || list_empty(&idev->tempaddr_list)) && +- idev->cnf.use_tempaddr > 0) { ++ /* Also create a temporary address if it's enabled but no temporary ++ * address currently exists. ++ * However, we get called with valid_lft == 0, prefered_lft == 0, create == false ++ * as part of cleanup (ie. deleting the mngtmpaddr). ++ * We don't want that to result in creating a new temporary ip address. ++ */ ++ if (list_empty(&idev->tempaddr_list) && (valid_lft || prefered_lft)) ++ create = true; ++ ++ if (create && idev->cnf.use_tempaddr > 0) { + /* When a new public address is created as described + * in [ADDRCONF], also create a new temporary address. +- * Also create a temporary address if it's enabled but +- * no temporary address currently exists. + */ + read_unlock_bh(&idev->lock); + ipv6_create_tempaddr(ifp, false); +-- +2.39.2 + diff --git a/queue-6.1/media-amphion-fix-firmware-path-to-match-linux-firmw.patch b/queue-6.1/media-amphion-fix-firmware-path-to-match-linux-firmw.patch new file mode 100644 index 00000000000..e86136fe780 --- /dev/null +++ b/queue-6.1/media-amphion-fix-firmware-path-to-match-linux-firmw.patch @@ -0,0 +1,46 @@ +From 725894b606cbb5d5764fc8e13246b517acd2ca03 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 May 2023 22:10:15 +0200 +Subject: media: amphion: Fix firmware path to match linux-firmware + +From: Nicolas Dufresne + +[ Upstream commit dcff0b56f661b6b42e828012b464d22cc2068c38 ] + +The path did not match the one it was submitted into linux-firmware +which prevented generic distribution from having working CODEC. + +Fixes: 9f599f351e86 ("media: amphion: add vpu core driver") +Signed-off-by: Nicolas Dufresne +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/platform/amphion/vpu_core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c +index f9ec1753f7c86..be80410682681 100644 +--- a/drivers/media/platform/amphion/vpu_core.c ++++ b/drivers/media/platform/amphion/vpu_core.c +@@ -828,7 +828,7 @@ static const struct dev_pm_ops vpu_core_pm_ops = { + + static struct vpu_core_resources imx8q_enc = { + .type = VPU_CORE_TYPE_ENC, +- .fwname = "vpu/vpu_fw_imx8_enc.bin", ++ .fwname = "amphion/vpu/vpu_fw_imx8_enc.bin", + .stride = 16, + .max_width = 1920, + .max_height = 1920, +@@ -843,7 +843,7 @@ static struct vpu_core_resources imx8q_enc = { + + static struct vpu_core_resources imx8q_dec = { + .type = VPU_CORE_TYPE_DEC, +- .fwname = "vpu/vpu_fw_imx8_dec.bin", ++ .fwname = "amphion/vpu/vpu_fw_imx8_dec.bin", + .stride = 256, + .max_width = 8188, + .max_height = 8188, +-- +2.39.2 + diff --git a/queue-6.1/media-staging-atomisp-select-v4l2_fwnode.patch b/queue-6.1/media-staging-atomisp-select-v4l2_fwnode.patch new file mode 100644 index 00000000000..a46bf2335d1 --- /dev/null +++ b/queue-6.1/media-staging-atomisp-select-v4l2_fwnode.patch @@ -0,0 +1,37 @@ +From 0964d70e63102b0bd6765d3f50e2eee782880fac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 13 Jun 2023 18:47:53 +0200 +Subject: media: staging: atomisp: select V4L2_FWNODE + +From: Sakari Ailus + +[ Upstream commit bf4c985707d3168ebb7d87d15830de66949d979c ] + +Select V4L2_FWNODE as the driver depends on it. + +Reported-by: Andy Shevchenko +Fixes: aa31f6514047 ("media: atomisp: allow building the driver again") +Signed-off-by: Sakari Ailus +Tested-by: Andy Shevchenko +Reviewed-by: Hans de Goede +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/staging/media/atomisp/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/staging/media/atomisp/Kconfig b/drivers/staging/media/atomisp/Kconfig +index 2c8d7fdcc5f7a..4881b6ea5237e 100644 +--- a/drivers/staging/media/atomisp/Kconfig ++++ b/drivers/staging/media/atomisp/Kconfig +@@ -13,6 +13,7 @@ config VIDEO_ATOMISP + tristate "Intel Atom Image Signal Processor Driver" + depends on VIDEO_DEV && INTEL_ATOMISP + depends on PMIC_OPREGION ++ select V4L2_FWNODE + select IOSF_MBI + select VIDEOBUF_VMALLOC + select VIDEO_V4L2_SUBDEV_API +-- +2.39.2 + diff --git a/queue-6.1/mm-suppress-mm-fault-logging-if-fatal-signal-already.patch b/queue-6.1/mm-suppress-mm-fault-logging-if-fatal-signal-already.patch new file mode 100644 index 00000000000..268a696786b --- /dev/null +++ b/queue-6.1/mm-suppress-mm-fault-logging-if-fatal-signal-already.patch @@ -0,0 +1,73 @@ +From edcbd6a3d37530d09fe3526d28ae7f14759db62d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jul 2023 09:38:32 -0700 +Subject: mm: suppress mm fault logging if fatal signal already pending + +From: Linus Torvalds + +[ Upstream commit 5f0bc0b042fc77ff70e14c790abdec960cde4ec1 ] + +Commit eda0047296a1 ("mm: make the page fault mmap locking killable") +intentionally made it much easier to trigger the "page fault fails +because a fatal signal is pending" situation, by having the mmap locking +fail early in that case. + +We have long aborted page faults in other fatal cases when the actual IO +for a page is interrupted by SIGKILL - which is particularly useful for +the traditional case of NFS hanging due to network issues, but local +filesystems could cause it too if you happened to get the SIGKILL while +waiting for a page to be faulted in (eg lock_folio_maybe_drop_mmap()). + +So aborting the page fault wasn't a new condition - but it now triggers +earlier, before we even get to 'handle_mm_fault()'. And as a result the +error doesn't go through our 'fault_signal_pending()' logic, and doesn't +get filtered away there. + +Normally you'd never even notice, because if a fatal signal is pending, +the new SIGSEGV we send ends up being ignored anyway. + +But it turns out that there is one very noticeable exception: if you +enable 'show_unhandled_signals', the aborted page fault will be logged +in the kernel messages, and you'll get a scary line looking something +like this in your logs: + + pverados[2183248]: segfault at 55e5a00f9ae0 ip 000055e5a00f9ae0 sp 00007ffc0720bea8 error 14 in perl[55e5a00d4000+195000] likely on CPU 10 (core 4, socket 0) + +which is rather misleading. It's not really a segfault at all, it's +just "the thread was killed before the page fault completed, so we +aborted the page fault". + +Fix this by just making it clear that a pending fatal signal means that +any new signal coming in after that is implicitly handled. This will +avoid the misleading logging, since now the signal isn't 'unhandled' any +more. + +Reported-and-tested-by: Fiona Ebner +Tested-by: Thomas Lamprecht +Link: https://lore.kernel.org/lkml/8d063a26-43f5-0bb7-3203-c6a04dc159f8@proxmox.com/ +Acked-by: Oleg Nesterov +Fixes: eda0047296a1 ("mm: make the page fault mmap locking killable") +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + kernel/signal.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/kernel/signal.c b/kernel/signal.c +index d140672185a48..5d45f5da2b36e 100644 +--- a/kernel/signal.c ++++ b/kernel/signal.c +@@ -561,6 +561,10 @@ bool unhandled_signal(struct task_struct *tsk, int sig) + if (handler != SIG_IGN && handler != SIG_DFL) + return false; + ++ /* If dying, we handle all new signals by ignoring them */ ++ if (fatal_signal_pending(tsk)) ++ return false; ++ + /* if ptraced, let the tracer determine */ + return !tsk->ptrace; + } +-- +2.39.2 + diff --git a/queue-6.1/net-hns3-fix-the-imp-capability-bit-cannot-exceed-32.patch b/queue-6.1/net-hns3-fix-the-imp-capability-bit-cannot-exceed-32.patch new file mode 100644 index 00000000000..3a5d3652f69 --- /dev/null +++ b/queue-6.1/net-hns3-fix-the-imp-capability-bit-cannot-exceed-32.patch @@ -0,0 +1,89 @@ +From 50bd516cdaa38904e26138878e71b88d0ecdd90b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jul 2023 10:05:07 +0800 +Subject: net: hns3: fix the imp capability bit cannot exceed 32 bits issue + +From: Hao Lan + +[ Upstream commit b27d0232e8897f7c896dc8ad80c9907dd57fd3f3 ] + +Current only the first 32 bits of the capability flag bit are considered. +When the matching capability flag bit is greater than 31 bits, +it will get an error bit.This patch use bitmap to solve this issue. +It can handle each capability bit whitout bit width limit. + +Fixes: da77aef9cc58 ("net: hns3: create common cmdq resource allocate/free/query APIs") +Signed-off-by: Hao Lan +Signed-off-by: Jijie Shao +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/hisilicon/hns3/hnae3.h | 3 ++- + .../hns3/hns3_common/hclge_comm_cmd.c | 21 ++++++++++++++++--- + 2 files changed, 20 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h +index 17137de9338cf..fcb8b6dc5ab92 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h ++++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include + + #define HNAE3_MOD_VERSION "1.0" +@@ -402,7 +403,7 @@ struct hnae3_ae_dev { + unsigned long hw_err_reset_req; + struct hnae3_dev_specs dev_specs; + u32 dev_version; +- unsigned long caps[BITS_TO_LONGS(HNAE3_DEV_CAPS_MAX_NUM)]; ++ DECLARE_BITMAP(caps, HNAE3_DEV_CAPS_MAX_NUM); + void *priv; + }; + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.c +index c797d54f98caa..2ccb0f5460797 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.c +@@ -170,6 +170,20 @@ static const struct hclge_comm_caps_bit_map hclge_vf_cmd_caps[] = { + {HCLGE_COMM_CAP_GRO_B, HNAE3_DEV_SUPPORT_GRO_B}, + }; + ++static void ++hclge_comm_capability_to_bitmap(unsigned long *bitmap, __le32 *caps) ++{ ++ const unsigned int words = HCLGE_COMM_QUERY_CAP_LENGTH; ++ u32 val[HCLGE_COMM_QUERY_CAP_LENGTH]; ++ unsigned int i; ++ ++ for (i = 0; i < words; i++) ++ val[i] = __le32_to_cpu(caps[i]); ++ ++ bitmap_from_arr32(bitmap, val, ++ HCLGE_COMM_QUERY_CAP_LENGTH * BITS_PER_TYPE(u32)); ++} ++ + static void + hclge_comm_parse_capability(struct hnae3_ae_dev *ae_dev, bool is_pf, + struct hclge_comm_query_version_cmd *cmd) +@@ -178,11 +192,12 @@ hclge_comm_parse_capability(struct hnae3_ae_dev *ae_dev, bool is_pf, + is_pf ? hclge_pf_cmd_caps : hclge_vf_cmd_caps; + u32 size = is_pf ? ARRAY_SIZE(hclge_pf_cmd_caps) : + ARRAY_SIZE(hclge_vf_cmd_caps); +- u32 caps, i; ++ DECLARE_BITMAP(caps, HCLGE_COMM_QUERY_CAP_LENGTH * BITS_PER_TYPE(u32)); ++ u32 i; + +- caps = __le32_to_cpu(cmd->caps[0]); ++ hclge_comm_capability_to_bitmap(caps, cmd->caps); + for (i = 0; i < size; i++) +- if (hnae3_get_bit(caps, caps_map[i].imp_bit)) ++ if (test_bit(caps_map[i].imp_bit, caps)) + set_bit(caps_map[i].local_bit, ae_dev->caps); + } + +-- +2.39.2 + diff --git a/queue-6.1/net-hns3-fix-wrong-bw-weight-of-disabled-tc-issue.patch b/queue-6.1/net-hns3-fix-wrong-bw-weight-of-disabled-tc-issue.patch new file mode 100644 index 00000000000..6c2130185cf --- /dev/null +++ b/queue-6.1/net-hns3-fix-wrong-bw-weight-of-disabled-tc-issue.patch @@ -0,0 +1,98 @@ +From f8be9f4502ed718dd2fafccfb8a5f5dedd9eb2c7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jul 2023 10:05:10 +0800 +Subject: net: hns3: fix wrong bw weight of disabled tc issue + +From: Jijie Shao + +[ Upstream commit 882481b1c55fc44861d7e2d54b4e0936b1b39f2c ] + +In dwrr mode, the default bandwidth weight of disabled tc is set to 0. +If the bandwidth weight is 0, the mode will change to sp. +Therefore, disabled tc default bandwidth weight need changed to 1, +and 0 is returned when query the bandwidth weight of disabled tc. +In addition, driver need stop configure bandwidth weight if tc is disabled. + +Fixes: 848440544b41 ("net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver") +Signed-off-by: Jie Wang +Signed-off-by: Jijie Shao +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 17 ++++++++++++++--- + .../ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 3 ++- + 2 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +index c4aded65e848b..09362823140d5 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +@@ -52,7 +52,10 @@ static void hclge_tm_info_to_ieee_ets(struct hclge_dev *hdev, + + for (i = 0; i < HNAE3_MAX_TC; i++) { + ets->prio_tc[i] = hdev->tm_info.prio_tc[i]; +- ets->tc_tx_bw[i] = hdev->tm_info.pg_info[0].tc_dwrr[i]; ++ if (i < hdev->tm_info.num_tc) ++ ets->tc_tx_bw[i] = hdev->tm_info.pg_info[0].tc_dwrr[i]; ++ else ++ ets->tc_tx_bw[i] = 0; + + if (hdev->tm_info.tc_info[i].tc_sch_mode == + HCLGE_SCH_MODE_SP) +@@ -123,7 +126,8 @@ static u8 hclge_ets_tc_changed(struct hclge_dev *hdev, struct ieee_ets *ets, + } + + static int hclge_ets_sch_mode_validate(struct hclge_dev *hdev, +- struct ieee_ets *ets, bool *changed) ++ struct ieee_ets *ets, bool *changed, ++ u8 tc_num) + { + bool has_ets_tc = false; + u32 total_ets_bw = 0; +@@ -137,6 +141,13 @@ static int hclge_ets_sch_mode_validate(struct hclge_dev *hdev, + *changed = true; + break; + case IEEE_8021QAZ_TSA_ETS: ++ if (i >= tc_num) { ++ dev_err(&hdev->pdev->dev, ++ "tc%u is disabled, cannot set ets bw\n", ++ i); ++ return -EINVAL; ++ } ++ + /* The hardware will switch to sp mode if bandwidth is + * 0, so limit ets bandwidth must be greater than 0. + */ +@@ -176,7 +187,7 @@ static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets, + if (ret) + return ret; + +- ret = hclge_ets_sch_mode_validate(hdev, ets, changed); ++ ret = hclge_ets_sch_mode_validate(hdev, ets, changed, tc_num); + if (ret) + return ret; + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +index 922c0da3660c7..150f146fa24fb 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +@@ -785,6 +785,7 @@ static void hclge_tm_tc_info_init(struct hclge_dev *hdev) + static void hclge_tm_pg_info_init(struct hclge_dev *hdev) + { + #define BW_PERCENT 100 ++#define DEFAULT_BW_WEIGHT 1 + + u8 i; + +@@ -806,7 +807,7 @@ static void hclge_tm_pg_info_init(struct hclge_dev *hdev) + for (k = 0; k < hdev->tm_info.num_tc; k++) + hdev->tm_info.pg_info[i].tc_dwrr[k] = BW_PERCENT; + for (; k < HNAE3_MAX_TC; k++) +- hdev->tm_info.pg_info[i].tc_dwrr[k] = 0; ++ hdev->tm_info.pg_info[i].tc_dwrr[k] = DEFAULT_BW_WEIGHT; + } + } + +-- +2.39.2 + diff --git a/queue-6.1/net-hns3-fix-wrong-tc-bandwidth-weight-data-issue.patch b/queue-6.1/net-hns3-fix-wrong-tc-bandwidth-weight-data-issue.patch new file mode 100644 index 00000000000..939ed565926 --- /dev/null +++ b/queue-6.1/net-hns3-fix-wrong-tc-bandwidth-weight-data-issue.patch @@ -0,0 +1,39 @@ +From 1039fe537d2c2819e19a8d9e51d6c0d07f65672f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jul 2023 10:05:09 +0800 +Subject: net: hns3: fix wrong tc bandwidth weight data issue + +From: Jijie Shao + +[ Upstream commit 116d9f732eef634abbd871f2c6f613a5b4677742 ] + +Currently, the weight saved by the driver is used as the query result, +which may be different from the actual weight in the register. +Therefore, the register value read from the firmware is used +as the query result + +Fixes: 0e32038dc856 ("net: hns3: refactor dump tc of debugfs") +Signed-off-by: Jijie Shao +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +index 0ebc21401b7c2..726062e512939 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +@@ -692,8 +692,7 @@ static int hclge_dbg_dump_tc(struct hclge_dev *hdev, char *buf, int len) + for (i = 0; i < HNAE3_MAX_TC; i++) { + sch_mode_str = ets_weight->tc_weight[i] ? "dwrr" : "sp"; + pos += scnprintf(buf + pos, len - pos, "%u %4s %3u\n", +- i, sch_mode_str, +- hdev->tm_info.pg_info[0].tc_dwrr[i]); ++ i, sch_mode_str, ets_weight->tc_weight[i]); + } + + return 0; +-- +2.39.2 + diff --git a/queue-6.1/net-phy-marvell10g-fix-88x3310-power-up.patch b/queue-6.1/net-phy-marvell10g-fix-88x3310-power-up.patch new file mode 100644 index 00000000000..364dbc7e4dd --- /dev/null +++ b/queue-6.1/net-phy-marvell10g-fix-88x3310-power-up.patch @@ -0,0 +1,45 @@ +From 59130b1104920d30122b4e200e909b307796a253 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 Jul 2023 17:22:33 +0800 +Subject: net: phy: marvell10g: fix 88x3310 power up + +From: Jiawen Wu + +[ Upstream commit c7b75bea853daeb64fc831dbf39a6bbabcc402ac ] + +Clear MV_V2_PORT_CTRL_PWRDOWN bit to set power up for 88x3310 PHY, +it sometimes does not take effect immediately. And a read of this +register causes the bit not to clear. This will cause mv3310_reset() +to time out, which will fail the config initialization. So add a delay +before the next access. + +Fixes: c9cc1c815d36 ("net: phy: marvell10g: place in powersave mode at probe") +Signed-off-by: Jiawen Wu +Reviewed-by: Russell King (Oracle) +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/phy/marvell10g.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c +index 383a9c9f36e54..057d294a273d8 100644 +--- a/drivers/net/phy/marvell10g.c ++++ b/drivers/net/phy/marvell10g.c +@@ -328,6 +328,13 @@ static int mv3310_power_up(struct phy_device *phydev) + ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, + MV_V2_PORT_CTRL_PWRDOWN); + ++ /* Sometimes, the power down bit doesn't clear immediately, and ++ * a read of this register causes the bit not to clear. Delay ++ * 100us to allow the PHY to come out of power down mode before ++ * the next access. ++ */ ++ udelay(100); ++ + if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310 || + priv->firmware_ver < 0x00030000) + return ret; +-- +2.39.2 + diff --git a/queue-6.1/net-sched-mqprio-add-extack-to-mqprio_parse_nlattr.patch b/queue-6.1/net-sched-mqprio-add-extack-to-mqprio_parse_nlattr.patch new file mode 100644 index 00000000000..23cc41f29f9 --- /dev/null +++ b/queue-6.1/net-sched-mqprio-add-extack-to-mqprio_parse_nlattr.patch @@ -0,0 +1,110 @@ +From 917a3acd0c503278c649657f64b1f1aadf62e446 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Apr 2023 21:01:51 +0300 +Subject: net/sched: mqprio: add extack to mqprio_parse_nlattr() + +From: Vladimir Oltean + +[ Upstream commit 57f21bf85400abadac0cb2a4db5de1d663f8863f ] + +Netlink attribute parsing in mqprio is a minesweeper game, with many +options having the possibility of being passed incorrectly and the user +being none the wiser. + +Try to make errors less sour by giving user space some information +regarding what went wrong. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Ferenc Fejes +Reviewed-by: Simon Horman +Acked-by: Jamal Hadi Salim +Signed-off-by: Jakub Kicinski +Stable-dep-of: 6c58c8816abb ("net/sched: mqprio: Add length check for TCA_MQPRIO_{MAX/MIN}_RATE64") +Signed-off-by: Sasha Levin +--- + net/sched/sch_mqprio.c | 30 +++++++++++++++++++++++------- + 1 file changed, 23 insertions(+), 7 deletions(-) + +diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c +index 166b22601e60f..1ab20d43c50b0 100644 +--- a/net/sched/sch_mqprio.c ++++ b/net/sched/sch_mqprio.c +@@ -131,7 +131,8 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla, + } + + static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, +- struct nlattr *opt) ++ struct nlattr *opt, ++ struct netlink_ext_ack *extack) + { + struct mqprio_sched *priv = qdisc_priv(sch); + struct nlattr *tb[TCA_MQPRIO_MAX + 1]; +@@ -143,8 +144,11 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, + if (err < 0) + return err; + +- if (!qopt->hw) ++ if (!qopt->hw) { ++ NL_SET_ERR_MSG(extack, ++ "mqprio TCA_OPTIONS can only contain netlink attributes in hardware mode"); + return -EINVAL; ++ } + + if (tb[TCA_MQPRIO_MODE]) { + priv->flags |= TC_MQPRIO_F_MODE; +@@ -157,13 +161,19 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, + } + + if (tb[TCA_MQPRIO_MIN_RATE64]) { +- if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) ++ if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) { ++ NL_SET_ERR_MSG_ATTR(extack, tb[TCA_MQPRIO_MIN_RATE64], ++ "min_rate accepted only when shaper is in bw_rlimit mode"); + return -EINVAL; ++ } + i = 0; + nla_for_each_nested(attr, tb[TCA_MQPRIO_MIN_RATE64], + rem) { +- if (nla_type(attr) != TCA_MQPRIO_MIN_RATE64) ++ if (nla_type(attr) != TCA_MQPRIO_MIN_RATE64) { ++ NL_SET_ERR_MSG_ATTR(extack, attr, ++ "Attribute type expected to be TCA_MQPRIO_MIN_RATE64"); + return -EINVAL; ++ } + if (i >= qopt->num_tc) + break; + priv->min_rate[i] = *(u64 *)nla_data(attr); +@@ -173,13 +183,19 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, + } + + if (tb[TCA_MQPRIO_MAX_RATE64]) { +- if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) ++ if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) { ++ NL_SET_ERR_MSG_ATTR(extack, tb[TCA_MQPRIO_MAX_RATE64], ++ "max_rate accepted only when shaper is in bw_rlimit mode"); + return -EINVAL; ++ } + i = 0; + nla_for_each_nested(attr, tb[TCA_MQPRIO_MAX_RATE64], + rem) { +- if (nla_type(attr) != TCA_MQPRIO_MAX_RATE64) ++ if (nla_type(attr) != TCA_MQPRIO_MAX_RATE64) { ++ NL_SET_ERR_MSG_ATTR(extack, attr, ++ "Attribute type expected to be TCA_MQPRIO_MAX_RATE64"); + return -EINVAL; ++ } + if (i >= qopt->num_tc) + break; + priv->max_rate[i] = *(u64 *)nla_data(attr); +@@ -224,7 +240,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt, + + len = nla_len(opt) - NLA_ALIGN(sizeof(*qopt)); + if (len > 0) { +- err = mqprio_parse_nlattr(sch, qopt, opt); ++ err = mqprio_parse_nlattr(sch, qopt, opt, extack); + if (err) + return err; + } +-- +2.39.2 + diff --git a/queue-6.1/net-sched-mqprio-add-length-check-for-tca_mqprio_-ma.patch b/queue-6.1/net-sched-mqprio-add-length-check-for-tca_mqprio_-ma.patch new file mode 100644 index 00000000000..09d8e96bbe0 --- /dev/null +++ b/queue-6.1/net-sched-mqprio-add-length-check-for-tca_mqprio_-ma.patch @@ -0,0 +1,63 @@ +From 9ffc81c264d6e80983154315f5806fd9043711b5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jul 2023 10:42:27 +0800 +Subject: net/sched: mqprio: Add length check for TCA_MQPRIO_{MAX/MIN}_RATE64 + +From: Lin Ma + +[ Upstream commit 6c58c8816abb7b93b21fa3b1d0c1726402e5e568 ] + +The nla_for_each_nested parsing in function mqprio_parse_nlattr() does +not check the length of the nested attribute. This can lead to an +out-of-attribute read and allow a malformed nlattr (e.g., length 0) to +be viewed as 8 byte integer and passed to priv->max_rate/min_rate. + +This patch adds the check based on nla_len() when check the nla_type(), +which ensures that the length of these two attribute must equals +sizeof(u64). + +Fixes: 4e8b86c06269 ("mqprio: Introduce new hardware offload mode and shaper in mqprio") +Reviewed-by: Victor Nogueira +Signed-off-by: Lin Ma +Link: https://lore.kernel.org/r/20230725024227.426561-1-linma@zju.edu.cn +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/sched/sch_mqprio.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c +index 1ab20d43c50b0..b99e0fe0229cf 100644 +--- a/net/sched/sch_mqprio.c ++++ b/net/sched/sch_mqprio.c +@@ -174,6 +174,13 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, + "Attribute type expected to be TCA_MQPRIO_MIN_RATE64"); + return -EINVAL; + } ++ ++ if (nla_len(attr) != sizeof(u64)) { ++ NL_SET_ERR_MSG_ATTR(extack, attr, ++ "Attribute TCA_MQPRIO_MIN_RATE64 expected to have 8 bytes length"); ++ return -EINVAL; ++ } ++ + if (i >= qopt->num_tc) + break; + priv->min_rate[i] = *(u64 *)nla_data(attr); +@@ -196,6 +203,13 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, + "Attribute type expected to be TCA_MQPRIO_MAX_RATE64"); + return -EINVAL; + } ++ ++ if (nla_len(attr) != sizeof(u64)) { ++ NL_SET_ERR_MSG_ATTR(extack, attr, ++ "Attribute TCA_MQPRIO_MAX_RATE64 expected to have 8 bytes length"); ++ return -EINVAL; ++ } ++ + if (i >= qopt->num_tc) + break; + priv->max_rate[i] = *(u64 *)nla_data(attr); +-- +2.39.2 + diff --git a/queue-6.1/net-sched-mqprio-refactor-nlattr-parsing-to-a-separa.patch b/queue-6.1/net-sched-mqprio-refactor-nlattr-parsing-to-a-separa.patch new file mode 100644 index 00000000000..ddc4cdc98da --- /dev/null +++ b/queue-6.1/net-sched-mqprio-refactor-nlattr-parsing-to-a-separa.patch @@ -0,0 +1,165 @@ +From 29502b068477a3c08ed0f7d8fd9bec1bb0c32e0b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 4 Feb 2023 15:52:55 +0200 +Subject: net/sched: mqprio: refactor nlattr parsing to a separate function + +From: Vladimir Oltean + +[ Upstream commit feb2cf3dcfb930aec2ca65c66d1365543d5ba943 ] + +mqprio_init() is quite large and unwieldy to add more code to. +Split the netlink attribute parsing to a dedicated function. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Jacob Keller +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Stable-dep-of: 6c58c8816abb ("net/sched: mqprio: Add length check for TCA_MQPRIO_{MAX/MIN}_RATE64") +Signed-off-by: Sasha Levin +--- + net/sched/sch_mqprio.c | 114 +++++++++++++++++++++++------------------ + 1 file changed, 63 insertions(+), 51 deletions(-) + +diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c +index 9f26fb7d5823c..166b22601e60f 100644 +--- a/net/sched/sch_mqprio.c ++++ b/net/sched/sch_mqprio.c +@@ -130,6 +130,67 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla, + return 0; + } + ++static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, ++ struct nlattr *opt) ++{ ++ struct mqprio_sched *priv = qdisc_priv(sch); ++ struct nlattr *tb[TCA_MQPRIO_MAX + 1]; ++ struct nlattr *attr; ++ int i, rem, err; ++ ++ err = parse_attr(tb, TCA_MQPRIO_MAX, opt, mqprio_policy, ++ sizeof(*qopt)); ++ if (err < 0) ++ return err; ++ ++ if (!qopt->hw) ++ return -EINVAL; ++ ++ if (tb[TCA_MQPRIO_MODE]) { ++ priv->flags |= TC_MQPRIO_F_MODE; ++ priv->mode = *(u16 *)nla_data(tb[TCA_MQPRIO_MODE]); ++ } ++ ++ if (tb[TCA_MQPRIO_SHAPER]) { ++ priv->flags |= TC_MQPRIO_F_SHAPER; ++ priv->shaper = *(u16 *)nla_data(tb[TCA_MQPRIO_SHAPER]); ++ } ++ ++ if (tb[TCA_MQPRIO_MIN_RATE64]) { ++ if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) ++ return -EINVAL; ++ i = 0; ++ nla_for_each_nested(attr, tb[TCA_MQPRIO_MIN_RATE64], ++ rem) { ++ if (nla_type(attr) != TCA_MQPRIO_MIN_RATE64) ++ return -EINVAL; ++ if (i >= qopt->num_tc) ++ break; ++ priv->min_rate[i] = *(u64 *)nla_data(attr); ++ i++; ++ } ++ priv->flags |= TC_MQPRIO_F_MIN_RATE; ++ } ++ ++ if (tb[TCA_MQPRIO_MAX_RATE64]) { ++ if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) ++ return -EINVAL; ++ i = 0; ++ nla_for_each_nested(attr, tb[TCA_MQPRIO_MAX_RATE64], ++ rem) { ++ if (nla_type(attr) != TCA_MQPRIO_MAX_RATE64) ++ return -EINVAL; ++ if (i >= qopt->num_tc) ++ break; ++ priv->max_rate[i] = *(u64 *)nla_data(attr); ++ i++; ++ } ++ priv->flags |= TC_MQPRIO_F_MAX_RATE; ++ } ++ ++ return 0; ++} ++ + static int mqprio_init(struct Qdisc *sch, struct nlattr *opt, + struct netlink_ext_ack *extack) + { +@@ -139,9 +200,6 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt, + struct Qdisc *qdisc; + int i, err = -EOPNOTSUPP; + struct tc_mqprio_qopt *qopt = NULL; +- struct nlattr *tb[TCA_MQPRIO_MAX + 1]; +- struct nlattr *attr; +- int rem; + int len; + + BUILD_BUG_ON(TC_MAX_QUEUE != TC_QOPT_MAX_QUEUE); +@@ -166,55 +224,9 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt, + + len = nla_len(opt) - NLA_ALIGN(sizeof(*qopt)); + if (len > 0) { +- err = parse_attr(tb, TCA_MQPRIO_MAX, opt, mqprio_policy, +- sizeof(*qopt)); +- if (err < 0) ++ err = mqprio_parse_nlattr(sch, qopt, opt); ++ if (err) + return err; +- +- if (!qopt->hw) +- return -EINVAL; +- +- if (tb[TCA_MQPRIO_MODE]) { +- priv->flags |= TC_MQPRIO_F_MODE; +- priv->mode = *(u16 *)nla_data(tb[TCA_MQPRIO_MODE]); +- } +- +- if (tb[TCA_MQPRIO_SHAPER]) { +- priv->flags |= TC_MQPRIO_F_SHAPER; +- priv->shaper = *(u16 *)nla_data(tb[TCA_MQPRIO_SHAPER]); +- } +- +- if (tb[TCA_MQPRIO_MIN_RATE64]) { +- if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) +- return -EINVAL; +- i = 0; +- nla_for_each_nested(attr, tb[TCA_MQPRIO_MIN_RATE64], +- rem) { +- if (nla_type(attr) != TCA_MQPRIO_MIN_RATE64) +- return -EINVAL; +- if (i >= qopt->num_tc) +- break; +- priv->min_rate[i] = *(u64 *)nla_data(attr); +- i++; +- } +- priv->flags |= TC_MQPRIO_F_MIN_RATE; +- } +- +- if (tb[TCA_MQPRIO_MAX_RATE64]) { +- if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) +- return -EINVAL; +- i = 0; +- nla_for_each_nested(attr, tb[TCA_MQPRIO_MAX_RATE64], +- rem) { +- if (nla_type(attr) != TCA_MQPRIO_MAX_RATE64) +- return -EINVAL; +- if (i >= qopt->num_tc) +- break; +- priv->max_rate[i] = *(u64 *)nla_data(attr); +- i++; +- } +- priv->flags |= TC_MQPRIO_F_MAX_RATE; +- } + } + + /* pre-allocate qdisc, attachment can't fail */ +-- +2.39.2 + diff --git a/queue-6.1/net-stmmac-apply-redundant-write-work-around-on-4.xx.patch b/queue-6.1/net-stmmac-apply-redundant-write-work-around-on-4.xx.patch new file mode 100644 index 00000000000..87b3f4acb7d --- /dev/null +++ b/queue-6.1/net-stmmac-apply-redundant-write-work-around-on-4.xx.patch @@ -0,0 +1,54 @@ +From 63d4bd77807f626de3c16ab4913a8f0e428b3554 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 15:39:20 +0200 +Subject: net: stmmac: Apply redundant write work around on 4.xx too + +From: Vincent Whitchurch + +[ Upstream commit 284779dbf4e98753458708783af8c35630674a21 ] + +commit a3a57bf07de23fe1ff779e0fdf710aa581c3ff73 ("net: stmmac: work +around sporadic tx issue on link-up") worked around a problem with TX +sometimes not working after a link-up by avoiding a redundant write to +MAC_CTRL_REG (aka GMAC_CONFIG), since the IP appeared to have problems +with handling multiple writes to that register in some cases. + +That commit however only added the work around to dwmac_lib.c (apart +from the common code in stmmac_main.c), but my systems with version +4.21a of the IP exhibit the same problem, so add the work around to +dwmac4_lib.c too. + +Fixes: a3a57bf07de2 ("net: stmmac: work around sporadic tx issue on link-up") +Signed-off-by: Vincent Whitchurch +Reviewed-by: Simon Horman +Link: https://lore.kernel.org/r/20230721-stmmac-tx-workaround-v1-1-9411cbd5ee07@axis.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +index d1c605777985f..7c26394f665e4 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +@@ -207,13 +207,15 @@ void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, const u8 addr[6], + void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable) + { + u32 value = readl(ioaddr + GMAC_CONFIG); ++ u32 old_val = value; + + if (enable) + value |= GMAC_CONFIG_RE | GMAC_CONFIG_TE; + else + value &= ~(GMAC_CONFIG_TE | GMAC_CONFIG_RE); + +- writel(value, ioaddr + GMAC_CONFIG); ++ if (value != old_val) ++ writel(value, ioaddr + GMAC_CONFIG); + } + + void stmmac_dwmac4_get_mac_addr(void __iomem *ioaddr, unsigned char *addr, +-- +2.39.2 + diff --git a/queue-6.1/netfilter-nf_tables-disallow-rule-addition-to-bound-.patch b/queue-6.1/netfilter-nf_tables-disallow-rule-addition-to-bound-.patch new file mode 100644 index 00000000000..c0d22071895 --- /dev/null +++ b/queue-6.1/netfilter-nf_tables-disallow-rule-addition-to-bound-.patch @@ -0,0 +1,53 @@ +From e3193cb248f502d96366138c389261c7696a44c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 23 Jul 2023 16:41:48 +0200 +Subject: netfilter: nf_tables: disallow rule addition to bound chain via + NFTA_RULE_CHAIN_ID + +From: Pablo Neira Ayuso + +[ Upstream commit 0ebc1064e4874d5987722a2ddbc18f94aa53b211 ] + +Bail out with EOPNOTSUPP when adding rule to bound chain via +NFTA_RULE_CHAIN_ID. The following warning splat is shown when +adding a rule to a deleted bound chain: + + WARNING: CPU: 2 PID: 13692 at net/netfilter/nf_tables_api.c:2013 nf_tables_chain_destroy+0x1f7/0x210 [nf_tables] + CPU: 2 PID: 13692 Comm: chain-bound-rul Not tainted 6.1.39 #1 + RIP: 0010:nf_tables_chain_destroy+0x1f7/0x210 [nf_tables] + +Fixes: d0e2c7de92c7 ("netfilter: nf_tables: add NFT_CHAIN_BINDING") +Reported-by: Kevin Rich +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Florian Westphal +Signed-off-by: Sasha Levin +--- + net/netfilter/nf_tables_api.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index e2e5ff6acd2bf..dd57a9ebe113d 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -3626,8 +3626,6 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info, + NL_SET_BAD_ATTR(extack, nla[NFTA_RULE_CHAIN]); + return PTR_ERR(chain); + } +- if (nft_chain_is_bound(chain)) +- return -EOPNOTSUPP; + + } else if (nla[NFTA_RULE_CHAIN_ID]) { + chain = nft_chain_lookup_byid(net, table, nla[NFTA_RULE_CHAIN_ID], +@@ -3640,6 +3638,9 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info, + return -EINVAL; + } + ++ if (nft_chain_is_bound(chain)) ++ return -EOPNOTSUPP; ++ + if (nla[NFTA_RULE_HANDLE]) { + handle = be64_to_cpu(nla_get_be64(nla[NFTA_RULE_HANDLE])); + rule = __nft_rule_lookup(chain, handle); +-- +2.39.2 + diff --git a/queue-6.1/netfilter-nf_tables-skip-immediate-deactivate-in-_pr.patch b/queue-6.1/netfilter-nf_tables-skip-immediate-deactivate-in-_pr.patch new file mode 100644 index 00000000000..e2b86464b1b --- /dev/null +++ b/queue-6.1/netfilter-nf_tables-skip-immediate-deactivate-in-_pr.patch @@ -0,0 +1,89 @@ +From b1c3d0a017401ab672b9104a24508aa23198801b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 23 Jul 2023 16:24:46 +0200 +Subject: netfilter: nf_tables: skip immediate deactivate in _PREPARE_ERROR + +From: Pablo Neira Ayuso + +[ Upstream commit 0a771f7b266b02d262900c75f1e175c7fe76fec2 ] + +On error when building the rule, the immediate expression unbinds the +chain, hence objects can be deactivated by the transaction records. + +Otherwise, it is possible to trigger the following warning: + + WARNING: CPU: 3 PID: 915 at net/netfilter/nf_tables_api.c:2013 nf_tables_chain_destroy+0x1f7/0x210 [nf_tables] + CPU: 3 PID: 915 Comm: chain-bind-err- Not tainted 6.1.39 #1 + RIP: 0010:nf_tables_chain_destroy+0x1f7/0x210 [nf_tables] + +Fixes: 4bedf9eee016 ("netfilter: nf_tables: fix chain binding transaction logic") +Reported-by: Kevin Rich +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Florian Westphal +Signed-off-by: Sasha Levin +--- + net/netfilter/nft_immediate.c | 27 ++++++++++++++++++--------- + 1 file changed, 18 insertions(+), 9 deletions(-) + +diff --git a/net/netfilter/nft_immediate.c b/net/netfilter/nft_immediate.c +index 900e75e8c3465..391c18e4b3ebd 100644 +--- a/net/netfilter/nft_immediate.c ++++ b/net/netfilter/nft_immediate.c +@@ -125,15 +125,27 @@ static void nft_immediate_activate(const struct nft_ctx *ctx, + return nft_data_hold(&priv->data, nft_dreg_to_type(priv->dreg)); + } + ++static void nft_immediate_chain_deactivate(const struct nft_ctx *ctx, ++ struct nft_chain *chain, ++ enum nft_trans_phase phase) ++{ ++ struct nft_ctx chain_ctx; ++ struct nft_rule *rule; ++ ++ chain_ctx = *ctx; ++ chain_ctx.chain = chain; ++ ++ list_for_each_entry(rule, &chain->rules, list) ++ nft_rule_expr_deactivate(&chain_ctx, rule, phase); ++} ++ + static void nft_immediate_deactivate(const struct nft_ctx *ctx, + const struct nft_expr *expr, + enum nft_trans_phase phase) + { + const struct nft_immediate_expr *priv = nft_expr_priv(expr); + const struct nft_data *data = &priv->data; +- struct nft_ctx chain_ctx; + struct nft_chain *chain; +- struct nft_rule *rule; + + if (priv->dreg == NFT_REG_VERDICT) { + switch (data->verdict.code) { +@@ -143,20 +155,17 @@ static void nft_immediate_deactivate(const struct nft_ctx *ctx, + if (!nft_chain_binding(chain)) + break; + +- chain_ctx = *ctx; +- chain_ctx.chain = chain; +- +- list_for_each_entry(rule, &chain->rules, list) +- nft_rule_expr_deactivate(&chain_ctx, rule, phase); +- + switch (phase) { + case NFT_TRANS_PREPARE_ERROR: + nf_tables_unbind_chain(ctx, chain); +- fallthrough; ++ nft_deactivate_next(ctx->net, chain); ++ break; + case NFT_TRANS_PREPARE: ++ nft_immediate_chain_deactivate(ctx, chain, phase); + nft_deactivate_next(ctx->net, chain); + break; + default: ++ nft_immediate_chain_deactivate(ctx, chain, phase); + nft_chain_del(chain); + chain->bound = false; + chain->table->use--; +-- +2.39.2 + diff --git a/queue-6.1/netfilter-nft_set_rbtree-fix-overlap-expiration-walk.patch b/queue-6.1/netfilter-nft_set_rbtree-fix-overlap-expiration-walk.patch new file mode 100644 index 00000000000..0b1e55e209c --- /dev/null +++ b/queue-6.1/netfilter-nft_set_rbtree-fix-overlap-expiration-walk.patch @@ -0,0 +1,88 @@ +From ef60ce85991a62f84bc90ad734e7a34688803452 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jul 2023 21:30:05 +0200 +Subject: netfilter: nft_set_rbtree: fix overlap expiration walk + +From: Florian Westphal + +[ Upstream commit f718863aca469a109895cb855e6b81fff4827d71 ] + +The lazy gc on insert that should remove timed-out entries fails to release +the other half of the interval, if any. + +Can be reproduced with tests/shell/testcases/sets/0044interval_overlap_0 +in nftables.git and kmemleak enabled kernel. + +Second bug is the use of rbe_prev vs. prev pointer. +If rbe_prev() returns NULL after at least one iteration, rbe_prev points +to element that is not an end interval, hence it should not be removed. + +Lastly, check the genmask of the end interval if this is active in the +current generation. + +Fixes: c9e6978e2725 ("netfilter: nft_set_rbtree: Switch to node list walk for overlap detection") +Signed-off-by: Florian Westphal +Signed-off-by: Sasha Levin +--- + net/netfilter/nft_set_rbtree.c | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c +index 5c05c9b990fba..8d73fffd2d09d 100644 +--- a/net/netfilter/nft_set_rbtree.c ++++ b/net/netfilter/nft_set_rbtree.c +@@ -217,29 +217,37 @@ static void *nft_rbtree_get(const struct net *net, const struct nft_set *set, + + static int nft_rbtree_gc_elem(const struct nft_set *__set, + struct nft_rbtree *priv, +- struct nft_rbtree_elem *rbe) ++ struct nft_rbtree_elem *rbe, ++ u8 genmask) + { + struct nft_set *set = (struct nft_set *)__set; + struct rb_node *prev = rb_prev(&rbe->node); +- struct nft_rbtree_elem *rbe_prev = NULL; ++ struct nft_rbtree_elem *rbe_prev; + struct nft_set_gc_batch *gcb; + + gcb = nft_set_gc_batch_check(set, NULL, GFP_ATOMIC); + if (!gcb) + return -ENOMEM; + +- /* search for expired end interval coming before this element. */ ++ /* search for end interval coming before this element. ++ * end intervals don't carry a timeout extension, they ++ * are coupled with the interval start element. ++ */ + while (prev) { + rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node); +- if (nft_rbtree_interval_end(rbe_prev)) ++ if (nft_rbtree_interval_end(rbe_prev) && ++ nft_set_elem_active(&rbe_prev->ext, genmask)) + break; + + prev = rb_prev(prev); + } + +- if (rbe_prev) { ++ if (prev) { ++ rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node); ++ + rb_erase(&rbe_prev->node, &priv->root); + atomic_dec(&set->nelems); ++ nft_set_gc_batch_add(gcb, rbe_prev); + } + + rb_erase(&rbe->node, &priv->root); +@@ -321,7 +329,7 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, + + /* perform garbage collection to avoid bogus overlap reports. */ + if (nft_set_elem_expired(&rbe->ext)) { +- err = nft_rbtree_gc_elem(set, priv, rbe); ++ err = nft_rbtree_gc_elem(set, priv, rbe, genmask); + if (err < 0) + return err; + +-- +2.39.2 + diff --git a/queue-6.1/octeontx2-af-fix-hash-extraction-enable-configuratio.patch b/queue-6.1/octeontx2-af-fix-hash-extraction-enable-configuratio.patch new file mode 100644 index 00000000000..c0c3f46f9d1 --- /dev/null +++ b/queue-6.1/octeontx2-af-fix-hash-extraction-enable-configuratio.patch @@ -0,0 +1,117 @@ +From 1c3bd5448640e9d35dd3d8a1fb94270d16575dc6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 11:42:22 +0530 +Subject: octeontx2-af: Fix hash extraction enable configuration + +From: Suman Ghosh + +[ Upstream commit 4e62c99d71e56817c934caa2a709a775c8cee078 ] + +As of today, hash extraction support is enabled for all the silicons. +Because of which we are facing initialization issues when the silicon +does not support hash extraction. During creation of the hardware +parsing table for IPv6 address, we need to consider if hash extraction +is enabled then extract only 32 bit, otherwise 128 bit needs to be +extracted. This patch fixes the issue and configures the hardware parser +based on the availability of the feature. + +Fixes: a95ab93550d3 ("octeontx2-af: Use hashed field in MCAM key") +Signed-off-by: Suman Ghosh +Reviewed-by: Simon Horman +Link: https://lore.kernel.org/r/20230721061222.2632521-1-sumang@marvell.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + .../marvell/octeontx2/af/rvu_npc_hash.c | 43 ++++++++++++++++++- + .../marvell/octeontx2/af/rvu_npc_hash.h | 8 ++-- + 2 files changed, 46 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +index efc2e64689f7d..34fa59575fa91 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +@@ -218,13 +218,54 @@ void npc_config_secret_key(struct rvu *rvu, int blkaddr) + + void npc_program_mkex_hash(struct rvu *rvu, int blkaddr) + { ++ struct npc_mcam_kex_hash *mh = rvu->kpu.mkex_hash; + struct hw_cap *hwcap = &rvu->hw->cap; ++ u8 intf, ld, hdr_offset, byte_len; + struct rvu_hwinfo *hw = rvu->hw; +- u8 intf; ++ u64 cfg; + ++ /* Check if hardware supports hash extraction */ + if (!hwcap->npc_hash_extract) + return; + ++ /* Check if IPv6 source/destination address ++ * should be hash enabled. ++ * Hashing reduces 128bit SIP/DIP fields to 32bit ++ * so that 224 bit X2 key can be used for IPv6 based filters as well, ++ * which in turn results in more number of MCAM entries available for ++ * use. ++ * ++ * Hashing of IPV6 SIP/DIP is enabled in below scenarios ++ * 1. If the silicon variant supports hashing feature ++ * 2. If the number of bytes of IP addr being extracted is 4 bytes ie ++ * 32bit. The assumption here is that if user wants 8bytes of LSB of ++ * IP addr or full 16 bytes then his intention is not to use 32bit ++ * hash. ++ */ ++ for (intf = 0; intf < hw->npc_intfs; intf++) { ++ for (ld = 0; ld < NPC_MAX_LD; ld++) { ++ cfg = rvu_read64(rvu, blkaddr, ++ NPC_AF_INTFX_LIDX_LTX_LDX_CFG(intf, ++ NPC_LID_LC, ++ NPC_LT_LC_IP6, ++ ld)); ++ hdr_offset = FIELD_GET(NPC_HDR_OFFSET, cfg); ++ byte_len = FIELD_GET(NPC_BYTESM, cfg); ++ /* Hashing of IPv6 source/destination address should be ++ * enabled if, ++ * hdr_offset == 8 (offset of source IPv6 address) or ++ * hdr_offset == 24 (offset of destination IPv6) ++ * address) and the number of byte to be ++ * extracted is 4. As per hardware configuration ++ * byte_len should be == actual byte_len - 1. ++ * Hence byte_len is checked against 3 but nor 4. ++ */ ++ if ((hdr_offset == 8 || hdr_offset == 24) && byte_len == 3) ++ mh->lid_lt_ld_hash_en[intf][NPC_LID_LC][NPC_LT_LC_IP6][ld] = true; ++ } ++ } ++ ++ /* Update hash configuration if the field is hash enabled */ + for (intf = 0; intf < hw->npc_intfs; intf++) { + npc_program_mkex_hash_rx(rvu, blkaddr, intf); + npc_program_mkex_hash_tx(rvu, blkaddr, intf); +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h +index a1c3d987b8044..57a09328d46b5 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h +@@ -70,8 +70,8 @@ static struct npc_mcam_kex_hash npc_mkex_hash_default __maybe_unused = { + [NIX_INTF_RX] = { + [NPC_LID_LC] = { + [NPC_LT_LC_IP6] = { +- true, +- true, ++ false, ++ false, + }, + }, + }, +@@ -79,8 +79,8 @@ static struct npc_mcam_kex_hash npc_mkex_hash_default __maybe_unused = { + [NIX_INTF_TX] = { + [NPC_LID_LC] = { + [NPC_LT_LC_IP6] = { +- true, +- true, ++ false, ++ false, + }, + }, + }, +-- +2.39.2 + diff --git a/queue-6.1/octeontx2-af-removed-unnecessary-debug-messages.patch b/queue-6.1/octeontx2-af-removed-unnecessary-debug-messages.patch new file mode 100644 index 00000000000..7dd61704bd1 --- /dev/null +++ b/queue-6.1/octeontx2-af-removed-unnecessary-debug-messages.patch @@ -0,0 +1,77 @@ +From 8e20e701bc3218c311a1881f9b93c46873d4de96 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Feb 2023 09:33:01 +0530 +Subject: octeontx2-af: Removed unnecessary debug messages. + +From: Sunil Goutham + +[ Upstream commit 609aa68d60965f70485655def733d533f99b341b ] + +NPC exact match feature is supported only on one silicon +variant, removed debug messages which print that this +feature is not available on all other silicon variants. + +Signed-off-by: Sunil Goutham +Signed-off-by: Ratheesh Kannoth +Reviewed-by: Leon Romanovsky +Link: https://lore.kernel.org/r/20230201040301.1034843-1-rkannoth@marvell.com +Signed-off-by: Jakub Kicinski +Stable-dep-of: 4e62c99d71e5 ("octeontx2-af: Fix hash extraction enable configuration") +Signed-off-by: Sasha Levin +--- + .../marvell/octeontx2/af/rvu_npc_hash.c | 18 ++++-------------- + 1 file changed, 4 insertions(+), 14 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +index 3b0a66c0977a7..efc2e64689f7d 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +@@ -203,10 +203,8 @@ void npc_config_secret_key(struct rvu *rvu, int blkaddr) + struct rvu_hwinfo *hw = rvu->hw; + u8 intf; + +- if (!hwcap->npc_hash_extract) { +- dev_info(rvu->dev, "HW does not support secret key configuration\n"); ++ if (!hwcap->npc_hash_extract) + return; +- } + + for (intf = 0; intf < hw->npc_intfs; intf++) { + rvu_write64(rvu, blkaddr, NPC_AF_INTFX_SECRET_KEY0(intf), +@@ -224,10 +222,8 @@ void npc_program_mkex_hash(struct rvu *rvu, int blkaddr) + struct rvu_hwinfo *hw = rvu->hw; + u8 intf; + +- if (!hwcap->npc_hash_extract) { +- dev_dbg(rvu->dev, "Field hash extract feature is not supported\n"); ++ if (!hwcap->npc_hash_extract) + return; +- } + + for (intf = 0; intf < hw->npc_intfs; intf++) { + npc_program_mkex_hash_rx(rvu, blkaddr, intf); +@@ -1864,19 +1860,13 @@ int rvu_npc_exact_init(struct rvu *rvu) + + /* Check exact match feature is supported */ + npc_const3 = rvu_read64(rvu, blkaddr, NPC_AF_CONST3); +- if (!(npc_const3 & BIT_ULL(62))) { +- dev_info(rvu->dev, "%s: No support for exact match support\n", +- __func__); ++ if (!(npc_const3 & BIT_ULL(62))) + return 0; +- } + + /* Check if kex profile has enabled EXACT match nibble */ + cfg = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_KEX_CFG(NIX_INTF_RX)); +- if (!(cfg & NPC_EXACT_NIBBLE_HIT)) { +- dev_info(rvu->dev, "%s: NPC exact match nibble not enabled in KEX profile\n", +- __func__); ++ if (!(cfg & NPC_EXACT_NIBBLE_HIT)) + return 0; +- } + + /* Set capability to true */ + rvu->hw->cap.npc_exact_match_enabled = true; +-- +2.39.2 + diff --git a/queue-6.1/phy-hisilicon-fix-an-out-of-bounds-check-in-hisi_inn.patch b/queue-6.1/phy-hisilicon-fix-an-out-of-bounds-check-in-hisi_inn.patch new file mode 100644 index 00000000000..3298b66bf72 --- /dev/null +++ b/queue-6.1/phy-hisilicon-fix-an-out-of-bounds-check-in-hisi_inn.patch @@ -0,0 +1,44 @@ +From b05920f65078c2e86090ef104613234c06de13e0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 02:05:55 -0700 +Subject: phy: hisilicon: Fix an out of bounds check in hisi_inno_phy_probe() + +From: Harshit Mogalapalli + +[ Upstream commit 13c088cf3657d70893d75cf116be937f1509cc0f ] + +The size of array 'priv->ports[]' is INNO_PHY_PORT_NUM. + +In the for loop, 'i' is used as the index for array 'priv->ports[]' +with a check (i > INNO_PHY_PORT_NUM) which indicates that +INNO_PHY_PORT_NUM is allowed value for 'i' in the same loop. + +This > comparison needs to be changed to >=, otherwise it potentially leads +to an out of bounds write on the next iteration through the loop + +Fixes: ba8b0ee81fbb ("phy: add inno-usb2-phy driver for hi3798cv200 SoC") +Reported-by: Dan Carpenter +Signed-off-by: Harshit Mogalapalli +Link: https://lore.kernel.org/r/20230721090558.3588613-1-harshit.m.mogalapalli@oracle.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/hisilicon/phy-hisi-inno-usb2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c +index b133ae06757ab..a922fb11a1092 100644 +--- a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c ++++ b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c +@@ -158,7 +158,7 @@ static int hisi_inno_phy_probe(struct platform_device *pdev) + phy_set_drvdata(phy, &priv->ports[i]); + i++; + +- if (i > INNO_PHY_PORT_NUM) { ++ if (i >= INNO_PHY_PORT_NUM) { + dev_warn(dev, "Support %d ports in maximum\n", i); + of_node_put(child); + break; +-- +2.39.2 + diff --git a/queue-6.1/phy-phy-mtk-dp-fix-an-error-code-in-probe.patch b/queue-6.1/phy-phy-mtk-dp-fix-an-error-code-in-probe.patch new file mode 100644 index 00000000000..d470cc28c6f --- /dev/null +++ b/queue-6.1/phy-phy-mtk-dp-fix-an-error-code-in-probe.patch @@ -0,0 +1,37 @@ +From cb4a63202a18d705d4a169c0b676cb1a9d9fe8c5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Jul 2023 09:13:25 +0300 +Subject: phy: phy-mtk-dp: Fix an error code in probe() + +From: Dan Carpenter + +[ Upstream commit 5782017cc4d0c8f3425d55b893675bb8a20c33e9 ] + +Negative -EINVAL was intended instead of positive EINVAL. + +Fixes: 6a23afad443a ("phy: phy-mtk-dp: Add driver for DP phy") +Signed-off-by: Dan Carpenter +Reviewed-by: Chen-Yu Tsai +Link: https://lore.kernel.org/r/3c699e00-2883-40d9-92c3-0da1dc38fdd4@moroto.mountain +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/mediatek/phy-mtk-dp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/phy/mediatek/phy-mtk-dp.c b/drivers/phy/mediatek/phy-mtk-dp.c +index 232fd3f1ff1b1..d7024a1443358 100644 +--- a/drivers/phy/mediatek/phy-mtk-dp.c ++++ b/drivers/phy/mediatek/phy-mtk-dp.c +@@ -169,7 +169,7 @@ static int mtk_dp_phy_probe(struct platform_device *pdev) + + regs = *(struct regmap **)dev->platform_data; + if (!regs) +- return dev_err_probe(dev, EINVAL, ++ return dev_err_probe(dev, -EINVAL, + "No data passed, requires struct regmap**\n"); + + dp_phy = devm_kzalloc(dev, sizeof(*dp_phy), GFP_KERNEL); +-- +2.39.2 + diff --git a/queue-6.1/phy-qcom-snps-correct-struct-qcom_snps_hsphy-kerneld.patch b/queue-6.1/phy-qcom-snps-correct-struct-qcom_snps_hsphy-kerneld.patch new file mode 100644 index 00000000000..d0877812a30 --- /dev/null +++ b/queue-6.1/phy-qcom-snps-correct-struct-qcom_snps_hsphy-kerneld.patch @@ -0,0 +1,43 @@ +From fced04ff794831a02e2b88e0b1c5fe272dee64ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 7 May 2023 16:48:18 +0200 +Subject: phy: qcom-snps: correct struct qcom_snps_hsphy kerneldoc + +From: Krzysztof Kozlowski + +[ Upstream commit 2a881183dc5ab2474ef602e48fe7af34db460d95 ] + +Update kerneldoc of struct qcom_snps_hsphy to fix: + + drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c:135: warning: Function parameter or member 'update_seq_cfg' not described in 'qcom_snps_hsphy' + +Signed-off-by: Krzysztof Kozlowski +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20230507144818.193039-1-krzysztof.kozlowski@linaro.org +Signed-off-by: Vinod Koul +Stable-dep-of: 8a0eb8f9b9a0 ("phy: qcom-snps-femto-v2: properly enable ref clock") +Signed-off-by: Sasha Levin +--- + drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +index a590635962140..6c237f3cc66db 100644 +--- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c ++++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +@@ -115,11 +115,11 @@ struct phy_override_seq { + * + * @cfg_ahb_clk: AHB2PHY interface clock + * @ref_clk: phy reference clock +- * @iface_clk: phy interface clock + * @phy_reset: phy reset control + * @vregs: regulator supplies bulk data + * @phy_initialized: if PHY has been initialized correctly + * @mode: contains the current mode the PHY is in ++ * @update_seq_cfg: tuning parameters for phy init + */ + struct qcom_snps_hsphy { + struct phy *phy; +-- +2.39.2 + diff --git a/queue-6.1/phy-qcom-snps-femto-v2-keep-cfg_ahb_clk-enabled-duri.patch b/queue-6.1/phy-qcom-snps-femto-v2-keep-cfg_ahb_clk-enabled-duri.patch new file mode 100644 index 00000000000..ff6f21cad32 --- /dev/null +++ b/queue-6.1/phy-qcom-snps-femto-v2-keep-cfg_ahb_clk-enabled-duri.patch @@ -0,0 +1,96 @@ +From 4e8fc0b8e86061ed0c2129501d96292e355945fd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Jun 2023 10:45:38 -0400 +Subject: phy: qcom-snps-femto-v2: keep cfg_ahb_clk enabled during runtime + suspend + +From: Adrien Thierry + +[ Upstream commit 45d89a344eb46db9dce851c28e14f5e3c635c251 ] + +In the dwc3 core, both system and runtime suspend end up calling +dwc3_suspend_common(). From there, what happens for the PHYs depends on +the USB mode and whether the controller is entering system or runtime +suspend. + +HOST mode: + (1) system suspend on a non-wakeup-capable controller + + The [1] if branch is taken. dwc3_core_exit() is called, which ends up + calling phy_power_off() and phy_exit(). Those two functions decrease the + PM runtime count at some point, so they will trigger the PHY runtime + sleep (assuming the count is right). + + (2) runtime suspend / system suspend on a wakeup-capable controller + + The [1] branch is not taken. dwc3_suspend_common() calls + phy_pm_runtime_put_sync(). Assuming the ref count is right, the PHY + runtime suspend op is called. + +DEVICE mode: + dwc3_core_exit() is called on both runtime and system sleep + unless the controller is already runtime suspended. + +OTG mode: + (1) system suspend : dwc3_core_exit() is called + + (2) runtime suspend : do nothing + +In host mode, the code seems to make a distinction between 1) runtime +sleep / system sleep for wakeup-capable controller, and 2) system sleep +for non-wakeup-capable controller, where phy_power_off() and phy_exit() +are only called for the latter. This suggests the PHY is not supposed to +be in a fully powered-off state for runtime sleep and system sleep for +wakeup-capable controller. + +Moreover, downstream, cfg_ahb_clk only gets disabled for system suspend. +The clocks are disabled by phy->set_suspend() [2] which is only called +in the system sleep path through dwc3_core_exit() [3]. + +With that in mind, don't disable the clocks during the femto PHY runtime +suspend callback. The clocks will only be disabled during system suspend +for non-wakeup-capable controllers, through dwc3_core_exit(). + +[1] https://elixir.bootlin.com/linux/v6.4/source/drivers/usb/dwc3/core.c#L1988 +[2] https://git.codelinaro.org/clo/la/kernel/msm-5.4/-/blob/LV.AU.1.2.1.r2-05300-gen3meta.0/drivers/usb/phy/phy-msm-snps-hs.c#L524 +[3] https://git.codelinaro.org/clo/la/kernel/msm-5.4/-/blob/LV.AU.1.2.1.r2-05300-gen3meta.0/drivers/usb/dwc3/core.c#L1915 + +Signed-off-by: Adrien Thierry +Link: https://lore.kernel.org/r/20230629144542.14906-2-athierry@redhat.com +Signed-off-by: Vinod Koul +Stable-dep-of: 8a0eb8f9b9a0 ("phy: qcom-snps-femto-v2: properly enable ref clock") +Signed-off-by: Sasha Levin +--- + drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +index 6c237f3cc66db..3335480fc395a 100644 +--- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c ++++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +@@ -165,22 +165,13 @@ static int qcom_snps_hsphy_suspend(struct qcom_snps_hsphy *hsphy) + 0, USB2_AUTO_RESUME); + } + +- clk_disable_unprepare(hsphy->cfg_ahb_clk); + return 0; + } + + static int qcom_snps_hsphy_resume(struct qcom_snps_hsphy *hsphy) + { +- int ret; +- + dev_dbg(&hsphy->phy->dev, "Resume QCOM SNPS PHY, mode\n"); + +- ret = clk_prepare_enable(hsphy->cfg_ahb_clk); +- if (ret) { +- dev_err(&hsphy->phy->dev, "failed to enable cfg ahb clock\n"); +- return ret; +- } +- + return 0; + } + +-- +2.39.2 + diff --git a/queue-6.1/phy-qcom-snps-femto-v2-properly-enable-ref-clock.patch b/queue-6.1/phy-qcom-snps-femto-v2-properly-enable-ref-clock.patch new file mode 100644 index 00000000000..b35a73b1e93 --- /dev/null +++ b/queue-6.1/phy-qcom-snps-femto-v2-properly-enable-ref-clock.patch @@ -0,0 +1,173 @@ +From eff2bbab48e35ce486cd42ea1091f62f09e2ad51 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Jun 2023 10:45:39 -0400 +Subject: phy: qcom-snps-femto-v2: properly enable ref clock + +From: Adrien Thierry + +[ Upstream commit 8a0eb8f9b9a002291a3934acfd913660b905249e ] + +The driver is not enabling the ref clock, which thus gets disabled by +the clk_disable_unused() initcall. This leads to the dwc3 controller +failing to initialize if probed after clk_disable_unused() is called, +for instance when the driver is built as a module. + +To fix this, switch to the clk_bulk API to handle both cfg_ahb and ref +clocks at the proper places. + +Note that the cfg_ahb clock is currently not used by any device tree +instantiation of the PHY. Work needs to be done separately to fix this. + +Link: https://lore.kernel.org/linux-arm-msm/ZEqvy+khHeTkC2hf@fedora/ +Fixes: 51e8114f80d0 ("phy: qcom-snps: Add SNPS USB PHY driver for QCOM based SOCs") +Signed-off-by: Adrien Thierry +Link: https://lore.kernel.org/r/20230629144542.14906-3-athierry@redhat.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 63 ++++++++++++++----- + 1 file changed, 48 insertions(+), 15 deletions(-) + +diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +index 3335480fc395a..6170f8fd118e2 100644 +--- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c ++++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c +@@ -110,11 +110,13 @@ struct phy_override_seq { + /** + * struct qcom_snps_hsphy - snps hs phy attributes + * ++ * @dev: device structure ++ * + * @phy: generic phy + * @base: iomapped memory space for snps hs phy + * +- * @cfg_ahb_clk: AHB2PHY interface clock +- * @ref_clk: phy reference clock ++ * @num_clks: number of clocks ++ * @clks: array of clocks + * @phy_reset: phy reset control + * @vregs: regulator supplies bulk data + * @phy_initialized: if PHY has been initialized correctly +@@ -122,11 +124,13 @@ struct phy_override_seq { + * @update_seq_cfg: tuning parameters for phy init + */ + struct qcom_snps_hsphy { ++ struct device *dev; ++ + struct phy *phy; + void __iomem *base; + +- struct clk *cfg_ahb_clk; +- struct clk *ref_clk; ++ int num_clks; ++ struct clk_bulk_data *clks; + struct reset_control *phy_reset; + struct regulator_bulk_data vregs[SNPS_HS_NUM_VREGS]; + +@@ -135,6 +139,34 @@ struct qcom_snps_hsphy { + struct phy_override_seq update_seq_cfg[NUM_HSPHY_TUNING_PARAMS]; + }; + ++static int qcom_snps_hsphy_clk_init(struct qcom_snps_hsphy *hsphy) ++{ ++ struct device *dev = hsphy->dev; ++ ++ hsphy->num_clks = 2; ++ hsphy->clks = devm_kcalloc(dev, hsphy->num_clks, sizeof(*hsphy->clks), GFP_KERNEL); ++ if (!hsphy->clks) ++ return -ENOMEM; ++ ++ /* ++ * TODO: Currently no device tree instantiation of the PHY is using the clock. ++ * This needs to be fixed in order for this code to be able to use devm_clk_bulk_get(). ++ */ ++ hsphy->clks[0].id = "cfg_ahb"; ++ hsphy->clks[0].clk = devm_clk_get_optional(dev, "cfg_ahb"); ++ if (IS_ERR(hsphy->clks[0].clk)) ++ return dev_err_probe(dev, PTR_ERR(hsphy->clks[0].clk), ++ "failed to get cfg_ahb clk\n"); ++ ++ hsphy->clks[1].id = "ref"; ++ hsphy->clks[1].clk = devm_clk_get(dev, "ref"); ++ if (IS_ERR(hsphy->clks[1].clk)) ++ return dev_err_probe(dev, PTR_ERR(hsphy->clks[1].clk), ++ "failed to get ref clk\n"); ++ ++ return 0; ++} ++ + static inline void qcom_snps_hsphy_write_mask(void __iomem *base, u32 offset, + u32 mask, u32 val) + { +@@ -365,16 +397,16 @@ static int qcom_snps_hsphy_init(struct phy *phy) + if (ret) + return ret; + +- ret = clk_prepare_enable(hsphy->cfg_ahb_clk); ++ ret = clk_bulk_prepare_enable(hsphy->num_clks, hsphy->clks); + if (ret) { +- dev_err(&phy->dev, "failed to enable cfg ahb clock, %d\n", ret); ++ dev_err(&phy->dev, "failed to enable clocks, %d\n", ret); + goto poweroff_phy; + } + + ret = reset_control_assert(hsphy->phy_reset); + if (ret) { + dev_err(&phy->dev, "failed to assert phy_reset, %d\n", ret); +- goto disable_ahb_clk; ++ goto disable_clks; + } + + usleep_range(100, 150); +@@ -382,7 +414,7 @@ static int qcom_snps_hsphy_init(struct phy *phy) + ret = reset_control_deassert(hsphy->phy_reset); + if (ret) { + dev_err(&phy->dev, "failed to de-assert phy_reset, %d\n", ret); +- goto disable_ahb_clk; ++ goto disable_clks; + } + + qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_CFG0, +@@ -439,8 +471,8 @@ static int qcom_snps_hsphy_init(struct phy *phy) + + return 0; + +-disable_ahb_clk: +- clk_disable_unprepare(hsphy->cfg_ahb_clk); ++disable_clks: ++ clk_bulk_disable_unprepare(hsphy->num_clks, hsphy->clks); + poweroff_phy: + regulator_bulk_disable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs); + +@@ -452,7 +484,7 @@ static int qcom_snps_hsphy_exit(struct phy *phy) + struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy); + + reset_control_assert(hsphy->phy_reset); +- clk_disable_unprepare(hsphy->cfg_ahb_clk); ++ clk_bulk_disable_unprepare(hsphy->num_clks, hsphy->clks); + regulator_bulk_disable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs); + hsphy->phy_initialized = false; + +@@ -545,14 +577,15 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev) + if (!hsphy) + return -ENOMEM; + ++ hsphy->dev = dev; ++ + hsphy->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(hsphy->base)) + return PTR_ERR(hsphy->base); + +- hsphy->ref_clk = devm_clk_get(dev, "ref"); +- if (IS_ERR(hsphy->ref_clk)) +- return dev_err_probe(dev, PTR_ERR(hsphy->ref_clk), +- "failed to get ref clk\n"); ++ ret = qcom_snps_hsphy_clk_init(hsphy); ++ if (ret) ++ return dev_err_probe(dev, ret, "failed to initialize clocks\n"); + + hsphy->phy_reset = devm_reset_control_get_exclusive(&pdev->dev, NULL); + if (IS_ERR(hsphy->phy_reset)) { +-- +2.39.2 + diff --git a/queue-6.1/platform-x86-msi-laptop-fix-rfkill-out-of-sync-on-ms.patch b/queue-6.1/platform-x86-msi-laptop-fix-rfkill-out-of-sync-on-ms.patch new file mode 100644 index 00000000000..1dd0d124273 --- /dev/null +++ b/queue-6.1/platform-x86-msi-laptop-fix-rfkill-out-of-sync-on-ms.patch @@ -0,0 +1,79 @@ +From f69af4919c296317a7f50241b6df65e1c9ffb999 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 17:54:23 +0300 +Subject: platform/x86: msi-laptop: Fix rfkill out-of-sync on MSI Wind U100 + +From: Maxim Mikityanskiy + +[ Upstream commit ad084a6d99bc182bf109c190c808e2ea073ec57b ] + +Only the HW rfkill state is toggled on laptops with quirks->ec_read_only +(so far only MSI Wind U90/U100). There are, however, a few issues with +the implementation: + +1. The initial HW state is always unblocked, regardless of the actual + state on boot, because msi_init_rfkill only sets the SW state, + regardless of ec_read_only. + +2. The initial SW state corresponds to the actual state on boot, but it + can't be changed afterwards, because set_device_state returns + -EOPNOTSUPP. It confuses the userspace, making Wi-Fi and/or Bluetooth + unusable if it was blocked on boot, and breaking the airplane mode if + the rfkill was unblocked on boot. + +Address the above issues by properly initializing the HW state on +ec_read_only laptops and by allowing the userspace to toggle the SW +state. Don't set the SW state ourselves and let the userspace fully +control it. Toggling the SW state is a no-op, however, it allows the +userspace to properly toggle the airplane mode. The actual SW radio +disablement is handled by the corresponding rtl818x_pci and btusb +drivers that have their own rfkills. + +Tested on MSI Wind U100 Plus, BIOS ver 1.0G, EC ver 130. + +Fixes: 0816392b97d4 ("msi-laptop: merge quirk tables to one") +Fixes: 0de6575ad0a8 ("msi-laptop: Add MSI Wind U90/U100 support") +Signed-off-by: Maxim Mikityanskiy +Link: https://lore.kernel.org/r/20230721145423.161057-1-maxtram95@gmail.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/msi-laptop.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c +index 6b18ec543ac3a..f4c6c36e05a52 100644 +--- a/drivers/platform/x86/msi-laptop.c ++++ b/drivers/platform/x86/msi-laptop.c +@@ -208,7 +208,7 @@ static ssize_t set_device_state(const char *buf, size_t count, u8 mask) + return -EINVAL; + + if (quirks->ec_read_only) +- return -EOPNOTSUPP; ++ return 0; + + /* read current device state */ + result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata); +@@ -838,15 +838,15 @@ static bool msi_laptop_i8042_filter(unsigned char data, unsigned char str, + static void msi_init_rfkill(struct work_struct *ignored) + { + if (rfk_wlan) { +- rfkill_set_sw_state(rfk_wlan, !wlan_s); ++ msi_rfkill_set_state(rfk_wlan, !wlan_s); + rfkill_wlan_set(NULL, !wlan_s); + } + if (rfk_bluetooth) { +- rfkill_set_sw_state(rfk_bluetooth, !bluetooth_s); ++ msi_rfkill_set_state(rfk_bluetooth, !bluetooth_s); + rfkill_bluetooth_set(NULL, !bluetooth_s); + } + if (rfk_threeg) { +- rfkill_set_sw_state(rfk_threeg, !threeg_s); ++ msi_rfkill_set_state(rfk_threeg, !threeg_s); + rfkill_threeg_set(NULL, !threeg_s); + } + } +-- +2.39.2 + diff --git a/queue-6.1/series b/queue-6.1/series index 86cd355f120..aa962f7ccef 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -71,3 +71,44 @@ drm-amd-display-prevent-vtotal-from-being-set-to-0.patch jbd2-remove-t_checkpoint_io_list.patch jbd2-remove-journal_clean_one_cp_list.patch jbd2-fix-a-race-when-checking-checkpoint-buffer-busy.patch +phy-phy-mtk-dp-fix-an-error-code-in-probe.patch +phy-qcom-snps-correct-struct-qcom_snps_hsphy-kerneld.patch +phy-qcom-snps-femto-v2-keep-cfg_ahb_clk-enabled-duri.patch +phy-qcom-snps-femto-v2-properly-enable-ref-clock.patch +soundwire-qcom-update-status-correctly-with-mask.patch +media-staging-atomisp-select-v4l2_fwnode.patch +media-amphion-fix-firmware-path-to-match-linux-firmw.patch +i40e-fix-an-null-vs-is_err-bug-for-debugfs_create_di.patch +iavf-fix-potential-deadlock-on-allocation-failure.patch +iavf-check-for-removal-state-before-iavf_flag_pf_com.patch +net-phy-marvell10g-fix-88x3310-power-up.patch +net-hns3-fix-the-imp-capability-bit-cannot-exceed-32.patch +net-hns3-fix-wrong-tc-bandwidth-weight-data-issue.patch +net-hns3-fix-wrong-bw-weight-of-disabled-tc-issue.patch +vxlan-calculate-correct-header-length-for-gpe.patch +vxlan-generalize-vxlan_parse_gpe_hdr-and-remove-unus.patch +vxlan-fix-gro-with-vxlan-gpe.patch +phy-hisilicon-fix-an-out-of-bounds-check-in-hisi_inn.patch +atheros-fix-return-value-check-in-atl1_tso.patch +ethernet-atheros-fix-return-value-check-in-atl1e_tso.patch +ipv6-addrconf-fix-bug-where-deleting-a-mngtmpaddr-ca.patch +tcp-reduce-chance-of-collisions-in-inet6_hashfn.patch +ice-fix-memory-management-in-ice_ethtool_fdir.c.patch +bonding-reset-bond-s-flags-when-down-link-is-p2p-dev.patch +team-reset-team-s-flags-when-down-link-is-p2p-device.patch +octeontx2-af-removed-unnecessary-debug-messages.patch +octeontx2-af-fix-hash-extraction-enable-configuratio.patch +net-stmmac-apply-redundant-write-work-around-on-4.xx.patch +platform-x86-msi-laptop-fix-rfkill-out-of-sync-on-ms.patch +x86-traps-fix-load_unaligned_zeropad-handling-for-sh.patch +igc-fix-kernel-panic-during-ndo_tx_timeout-callback.patch +netfilter-nft_set_rbtree-fix-overlap-expiration-walk.patch +netfilter-nf_tables-skip-immediate-deactivate-in-_pr.patch +netfilter-nf_tables-disallow-rule-addition-to-bound-.patch +mm-suppress-mm-fault-logging-if-fatal-signal-already.patch +net-sched-mqprio-refactor-nlattr-parsing-to-a-separa.patch +net-sched-mqprio-add-extack-to-mqprio_parse_nlattr.patch +net-sched-mqprio-add-length-check-for-tca_mqprio_-ma.patch +benet-fix-return-value-check-in-be_lancer_xmit_worka.patch +tipc-check-return-value-of-pskb_trim.patch +tipc-stop-tipc-crypto-on-failure-in-tipc_node_create.patch diff --git a/queue-6.1/soundwire-qcom-update-status-correctly-with-mask.patch b/queue-6.1/soundwire-qcom-update-status-correctly-with-mask.patch new file mode 100644 index 00000000000..76230cf03d6 --- /dev/null +++ b/queue-6.1/soundwire-qcom-update-status-correctly-with-mask.patch @@ -0,0 +1,37 @@ +From cf2311c4d495797b3af1e5b8b872fcc7fc32f669 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 May 2023 14:38:09 +0100 +Subject: soundwire: qcom: update status correctly with mask + +From: Srinivas Kandagatla + +[ Upstream commit f84d41b2a083b990cbdf70f3b24b6b108b9678ad ] + +SoundWire device status can be incorrectly updated without +proper mask, fix this by adding a mask before updating the status. + +Fixes: c7d49c76d1d5 ("soundwire: qcom: add support to new interrupts") +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230525133812.30841-2-srinivas.kandagatla@linaro.org +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/soundwire/qcom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c +index 08934d27f709e..a51c8a670d38a 100644 +--- a/drivers/soundwire/qcom.c ++++ b/drivers/soundwire/qcom.c +@@ -434,7 +434,7 @@ static int qcom_swrm_get_alert_slave_dev_num(struct qcom_swrm_ctrl *ctrl) + status = (val >> (dev_num * SWRM_MCP_SLV_STATUS_SZ)); + + if ((status & SWRM_MCP_SLV_STATUS_MASK) == SDW_SLAVE_ALERT) { +- ctrl->status[dev_num] = status; ++ ctrl->status[dev_num] = status & SWRM_MCP_SLV_STATUS_MASK; + return dev_num; + } + } +-- +2.39.2 + diff --git a/queue-6.1/tcp-reduce-chance-of-collisions-in-inet6_hashfn.patch b/queue-6.1/tcp-reduce-chance-of-collisions-in-inet6_hashfn.patch new file mode 100644 index 00000000000..fa070c3b620 --- /dev/null +++ b/queue-6.1/tcp-reduce-chance-of-collisions-in-inet6_hashfn.patch @@ -0,0 +1,75 @@ +From dadc869c86671deefa08fd45c23c2bdf171f6b34 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 15:24:10 -0700 +Subject: tcp: Reduce chance of collisions in inet6_hashfn(). + +From: Stewart Smith + +[ Upstream commit d11b0df7ddf1831f3e170972f43186dad520bfcc ] + +For both IPv4 and IPv6 incoming TCP connections are tracked in a hash +table with a hash over the source & destination addresses and ports. +However, the IPv6 hash is insufficient and can lead to a high rate of +collisions. + +The IPv6 hash used an XOR to fit everything into the 96 bits for the +fast jenkins hash, meaning it is possible for an external entity to +ensure the hash collides, thus falling back to a linear search in the +bucket, which is slow. + +We take the approach of hash the full length of IPv6 address in +__ipv6_addr_jhash() so that all users can benefit from a more secure +version. + +While this may look like it adds overhead, the reality of modern CPUs +means that this is unmeasurable in real world scenarios. + +In simulating with llvm-mca, the increase in cycles for the hashing +code was ~16 cycles on Skylake (from a base of ~155), and an extra ~9 +on Nehalem (base of ~173). + +In commit dd6d2910c5e0 ("netfilter: conntrack: switch to siphash") +netfilter switched from a jenkins hash to a siphash, but even the faster +hsiphash is a more significant overhead (~20-30%) in some preliminary +testing. So, in this patch, we keep to the more conservative approach to +ensure we don't add much overhead per SYN. + +In testing, this results in a consistently even spread across the +connection buckets. In both testing and real-world scenarios, we have +not found any measurable performance impact. + +Fixes: 08dcdbf6a7b9 ("ipv6: use a stronger hash for tcp") +Signed-off-by: Stewart Smith +Signed-off-by: Samuel Mendoza-Jonas +Suggested-by: Eric Dumazet +Signed-off-by: Kuniyuki Iwashima +Reviewed-by: Eric Dumazet +Link: https://lore.kernel.org/r/20230721222410.17914-1-kuniyu@amazon.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + include/net/ipv6.h | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/include/net/ipv6.h b/include/net/ipv6.h +index d383c895592a9..e4ceef687c1c2 100644 +--- a/include/net/ipv6.h ++++ b/include/net/ipv6.h +@@ -718,12 +718,8 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a) + /* more secured version of ipv6_addr_hash() */ + static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 initval) + { +- u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1]; +- +- return jhash_3words(v, +- (__force u32)a->s6_addr32[2], +- (__force u32)a->s6_addr32[3], +- initval); ++ return jhash2((__force const u32 *)a->s6_addr32, ++ ARRAY_SIZE(a->s6_addr32), initval); + } + + static inline bool ipv6_addr_loopback(const struct in6_addr *a) +-- +2.39.2 + diff --git a/queue-6.1/team-reset-team-s-flags-when-down-link-is-p2p-device.patch b/queue-6.1/team-reset-team-s-flags-when-down-link-is-p2p-device.patch new file mode 100644 index 00000000000..1509399d439 --- /dev/null +++ b/queue-6.1/team-reset-team-s-flags-when-down-link-is-p2p-device.patch @@ -0,0 +1,52 @@ +From 4bb612a9dc1b161694b52fe5fd972e8dcadf63ae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 12:03:56 +0800 +Subject: team: reset team's flags when down link is P2P device + +From: Hangbin Liu + +[ Upstream commit fa532bee17d15acf8bba4bc8e2062b7a093ba801 ] + +When adding a point to point downlink to team device, we neglected to reset +the team's flags, which were still using flags like BROADCAST and +MULTICAST. Consequently, this would initiate ARP/DAD for P2P downlink +interfaces, such as when adding a GRE device to team device. Fix this by +remove multicast/broadcast flags and add p2p and noarp flags. + +After removing the none ethernet interface and adding an ethernet interface +to team, we need to reset team interface flags. Unlike bonding interface, +team do not need restore IFF_MASTER, IFF_SLAVE flags. + +Reported-by: Liang Li +Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2221438 +Fixes: 1d76efe1577b ("team: add support for non-ethernet devices") +Signed-off-by: Hangbin Liu +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/team/team.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c +index b524bd374d685..509ba706781ed 100644 +--- a/drivers/net/team/team.c ++++ b/drivers/net/team/team.c +@@ -2135,6 +2135,15 @@ static void team_setup_by_port(struct net_device *dev, + dev->mtu = port_dev->mtu; + memcpy(dev->broadcast, port_dev->broadcast, port_dev->addr_len); + eth_hw_addr_inherit(dev, port_dev); ++ ++ if (port_dev->flags & IFF_POINTOPOINT) { ++ dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST); ++ dev->flags |= (IFF_POINTOPOINT | IFF_NOARP); ++ } else if ((port_dev->flags & (IFF_BROADCAST | IFF_MULTICAST)) == ++ (IFF_BROADCAST | IFF_MULTICAST)) { ++ dev->flags |= (IFF_BROADCAST | IFF_MULTICAST); ++ dev->flags &= ~(IFF_POINTOPOINT | IFF_NOARP); ++ } + } + + static int team_dev_type_check_change(struct net_device *dev, +-- +2.39.2 + diff --git a/queue-6.1/tipc-check-return-value-of-pskb_trim.patch b/queue-6.1/tipc-check-return-value-of-pskb_trim.patch new file mode 100644 index 00000000000..9d29fcfdbb3 --- /dev/null +++ b/queue-6.1/tipc-check-return-value-of-pskb_trim.patch @@ -0,0 +1,39 @@ +From d8f196a974eaf5872328c84e126bc2dbc7a93431 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jul 2023 14:48:10 +0800 +Subject: tipc: check return value of pskb_trim() + +From: Yuanjun Gong + +[ Upstream commit e46e06ffc6d667a89b979701288e2264f45e6a7b ] + +goto free_skb if an unexpected result is returned by pskb_tirm() +in tipc_crypto_rcv_complete(). + +Fixes: fc1b6d6de220 ("tipc: introduce TIPC encryption & authentication") +Signed-off-by: Yuanjun Gong +Reviewed-by: Tung Nguyen +Link: https://lore.kernel.org/r/20230725064810.5820-1-ruc_gongyuanjun@163.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + net/tipc/crypto.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c +index d67440de011e7..2b236d95a6469 100644 +--- a/net/tipc/crypto.c ++++ b/net/tipc/crypto.c +@@ -1960,7 +1960,8 @@ static void tipc_crypto_rcv_complete(struct net *net, struct tipc_aead *aead, + + skb_reset_network_header(*skb); + skb_pull(*skb, tipc_ehdr_size(ehdr)); +- pskb_trim(*skb, (*skb)->len - aead->authsize); ++ if (pskb_trim(*skb, (*skb)->len - aead->authsize)) ++ goto free_skb; + + /* Validate TIPCv2 message */ + if (unlikely(!tipc_msg_validate(skb))) { +-- +2.39.2 + diff --git a/queue-6.1/tipc-stop-tipc-crypto-on-failure-in-tipc_node_create.patch b/queue-6.1/tipc-stop-tipc-crypto-on-failure-in-tipc_node_create.patch new file mode 100644 index 00000000000..bd1aed50edf --- /dev/null +++ b/queue-6.1/tipc-stop-tipc-crypto-on-failure-in-tipc_node_create.patch @@ -0,0 +1,46 @@ +From 7956768394592bb2dcad83f18eeab1efde19a1a1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Jul 2023 00:46:25 +0300 +Subject: tipc: stop tipc crypto on failure in tipc_node_create + +From: Fedor Pchelkin + +[ Upstream commit de52e17326c3e9a719c9ead4adb03467b8fae0ef ] + +If tipc_link_bc_create() fails inside tipc_node_create() for a newly +allocated tipc node then we should stop its tipc crypto and free the +resources allocated with a call to tipc_crypto_start(). + +As the node ref is initialized to one to that point, just put the ref on +tipc_link_bc_create() error case that would lead to tipc_node_free() be +eventually executed and properly clean the node and its crypto resources. + +Found by Linux Verification Center (linuxtesting.org). + +Fixes: cb8092d70a6f ("tipc: move bc link creation back to tipc_node_create") +Suggested-by: Xin Long +Signed-off-by: Fedor Pchelkin +Reviewed-by: Xin Long +Link: https://lore.kernel.org/r/20230725214628.25246-1-pchelkin@ispras.ru +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + net/tipc/node.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/tipc/node.c b/net/tipc/node.c +index 5e000fde80676..a9c5b6594889b 100644 +--- a/net/tipc/node.c ++++ b/net/tipc/node.c +@@ -583,7 +583,7 @@ struct tipc_node *tipc_node_create(struct net *net, u32 addr, u8 *peer_id, + n->capabilities, &n->bc_entry.inputq1, + &n->bc_entry.namedq, snd_l, &n->bc_entry.link)) { + pr_warn("Broadcast rcv link creation failed, no memory\n"); +- kfree(n); ++ tipc_node_put(n); + n = NULL; + goto exit; + } +-- +2.39.2 + diff --git a/queue-6.1/vxlan-calculate-correct-header-length-for-gpe.patch b/queue-6.1/vxlan-calculate-correct-header-length-for-gpe.patch new file mode 100644 index 00000000000..a3c103e6c59 --- /dev/null +++ b/queue-6.1/vxlan-calculate-correct-header-length-for-gpe.patch @@ -0,0 +1,164 @@ +From 4f7de29190552d915984aa1b465b726f086745ba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jul 2023 11:05:56 +0200 +Subject: vxlan: calculate correct header length for GPE + +From: Jiri Benc + +[ Upstream commit 94d166c5318c6edd1e079df8552233443e909c33 ] + +VXLAN-GPE does not add an extra inner Ethernet header. Take that into +account when calculating header length. + +This causes problems in skb_tunnel_check_pmtu, where incorrect PMTU is +cached. + +In the collect_md mode (which is the only mode that VXLAN-GPE +supports), there's no magic auto-setting of the tunnel interface MTU. +It can't be, since the destination and thus the underlying interface +may be different for each packet. + +So, the administrator is responsible for setting the correct tunnel +interface MTU. Apparently, the administrators are capable enough to +calculate that the maximum MTU for VXLAN-GPE is (their_lower_MTU - 36). +They set the tunnel interface MTU to 1464. If you run a TCP stream over +such interface, it's then segmented according to the MTU 1464, i.e. +producing 1514 bytes frames. Which is okay, this still fits the lower +MTU. + +However, skb_tunnel_check_pmtu (called from vxlan_xmit_one) uses 50 as +the header size and thus incorrectly calculates the frame size to be +1528. This leads to ICMP too big message being generated (locally), +PMTU of 1450 to be cached and the TCP stream to be resegmented. + +The fix is to use the correct actual header size, especially for +skb_tunnel_check_pmtu calculation. + +Fixes: e1e5314de08ba ("vxlan: implement GPE") +Signed-off-by: Jiri Benc +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +- + drivers/net/vxlan/vxlan_core.c | 23 ++++++++----------- + include/net/vxlan.h | 13 +++++++---- + 3 files changed, 20 insertions(+), 18 deletions(-) + +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +index 9b8848daeb430..6105419ae2d5f 100644 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +@@ -8499,7 +8499,7 @@ static void ixgbe_atr(struct ixgbe_ring *ring, + struct ixgbe_adapter *adapter = q_vector->adapter; + + if (unlikely(skb_tail_pointer(skb) < hdr.network + +- VXLAN_HEADROOM)) ++ vxlan_headroom(0))) + return; + + /* verify the port is recognized as VXLAN */ +diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c +index d4be39b19a6be..719f862fa55eb 100644 +--- a/drivers/net/vxlan/vxlan_core.c ++++ b/drivers/net/vxlan/vxlan_core.c +@@ -2584,7 +2584,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, + } + + ndst = &rt->dst; +- err = skb_tunnel_check_pmtu(skb, ndst, VXLAN_HEADROOM, ++ err = skb_tunnel_check_pmtu(skb, ndst, vxlan_headroom(flags & VXLAN_F_GPE), + netif_is_any_bridge_port(dev)); + if (err < 0) { + goto tx_error; +@@ -2645,7 +2645,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, + goto out_unlock; + } + +- err = skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM, ++ err = skb_tunnel_check_pmtu(skb, ndst, ++ vxlan_headroom((flags & VXLAN_F_GPE) | VXLAN_F_IPV6), + netif_is_any_bridge_port(dev)); + if (err < 0) { + goto tx_error; +@@ -3034,14 +3035,12 @@ static int vxlan_change_mtu(struct net_device *dev, int new_mtu) + struct vxlan_rdst *dst = &vxlan->default_dst; + struct net_device *lowerdev = __dev_get_by_index(vxlan->net, + dst->remote_ifindex); +- bool use_ipv6 = !!(vxlan->cfg.flags & VXLAN_F_IPV6); + + /* This check is different than dev->max_mtu, because it looks at + * the lowerdev->mtu, rather than the static dev->max_mtu + */ + if (lowerdev) { +- int max_mtu = lowerdev->mtu - +- (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); ++ int max_mtu = lowerdev->mtu - vxlan_headroom(vxlan->cfg.flags); + if (new_mtu > max_mtu) + return -EINVAL; + } +@@ -3684,11 +3683,11 @@ static void vxlan_config_apply(struct net_device *dev, + struct vxlan_dev *vxlan = netdev_priv(dev); + struct vxlan_rdst *dst = &vxlan->default_dst; + unsigned short needed_headroom = ETH_HLEN; +- bool use_ipv6 = !!(conf->flags & VXLAN_F_IPV6); + int max_mtu = ETH_MAX_MTU; ++ u32 flags = conf->flags; + + if (!changelink) { +- if (conf->flags & VXLAN_F_GPE) ++ if (flags & VXLAN_F_GPE) + vxlan_raw_setup(dev); + else + vxlan_ether_setup(dev); +@@ -3713,8 +3712,7 @@ static void vxlan_config_apply(struct net_device *dev, + + dev->needed_tailroom = lowerdev->needed_tailroom; + +- max_mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : +- VXLAN_HEADROOM); ++ max_mtu = lowerdev->mtu - vxlan_headroom(flags); + if (max_mtu < ETH_MIN_MTU) + max_mtu = ETH_MIN_MTU; + +@@ -3725,10 +3723,9 @@ static void vxlan_config_apply(struct net_device *dev, + if (dev->mtu > max_mtu) + dev->mtu = max_mtu; + +- if (use_ipv6 || conf->flags & VXLAN_F_COLLECT_METADATA) +- needed_headroom += VXLAN6_HEADROOM; +- else +- needed_headroom += VXLAN_HEADROOM; ++ if (flags & VXLAN_F_COLLECT_METADATA) ++ flags |= VXLAN_F_IPV6; ++ needed_headroom += vxlan_headroom(flags); + dev->needed_headroom = needed_headroom; + + memcpy(&vxlan->cfg, conf, sizeof(*conf)); +diff --git a/include/net/vxlan.h b/include/net/vxlan.h +index bca5b01af2475..03bcc1ef0d61e 100644 +--- a/include/net/vxlan.h ++++ b/include/net/vxlan.h +@@ -378,10 +378,15 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb, + return features; + } + +-/* IP header + UDP + VXLAN + Ethernet header */ +-#define VXLAN_HEADROOM (20 + 8 + 8 + 14) +-/* IPv6 header + UDP + VXLAN + Ethernet header */ +-#define VXLAN6_HEADROOM (40 + 8 + 8 + 14) ++static inline int vxlan_headroom(u32 flags) ++{ ++ /* VXLAN: IP4/6 header + UDP + VXLAN + Ethernet header */ ++ /* VXLAN-GPE: IP4/6 header + UDP + VXLAN */ ++ return (flags & VXLAN_F_IPV6 ? sizeof(struct ipv6hdr) : ++ sizeof(struct iphdr)) + ++ sizeof(struct udphdr) + sizeof(struct vxlanhdr) + ++ (flags & VXLAN_F_GPE ? 0 : ETH_HLEN); ++} + + static inline struct vxlanhdr *vxlan_hdr(struct sk_buff *skb) + { +-- +2.39.2 + diff --git a/queue-6.1/vxlan-fix-gro-with-vxlan-gpe.patch b/queue-6.1/vxlan-fix-gro-with-vxlan-gpe.patch new file mode 100644 index 00000000000..56cf09870f1 --- /dev/null +++ b/queue-6.1/vxlan-fix-gro-with-vxlan-gpe.patch @@ -0,0 +1,173 @@ +From f07e769507bf0dfc8a82e85b5fc9046a0bdc103e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 16:30:47 +0200 +Subject: vxlan: fix GRO with VXLAN-GPE + +From: Jiri Benc + +[ Upstream commit b0b672c4d0957e5897685667fc848132b8bd2d71 ] + +In VXLAN-GPE, there may not be an Ethernet header following the VXLAN +header. But in GRO, the vxlan driver calls eth_gro_receive +unconditionally, which means the following header is incorrectly parsed +as Ethernet. + +Introduce GPE specific GRO handling. + +For better performance, do not check for GPE during GRO but rather +install a different set of functions at setup time. + +Fixes: e1e5314de08ba ("vxlan: implement GPE") +Reported-by: Paolo Abeni +Signed-off-by: Jiri Benc +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/vxlan/vxlan_core.c | 84 ++++++++++++++++++++++++++++------ + 1 file changed, 69 insertions(+), 15 deletions(-) + +diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c +index 0dc7326fd6ed4..0c3eb850fcb79 100644 +--- a/drivers/net/vxlan/vxlan_core.c ++++ b/drivers/net/vxlan/vxlan_core.c +@@ -722,26 +722,24 @@ static struct vxlanhdr *vxlan_gro_remcsum(struct sk_buff *skb, + return vh; + } + +-static struct sk_buff *vxlan_gro_receive(struct sock *sk, +- struct list_head *head, +- struct sk_buff *skb) ++static struct vxlanhdr *vxlan_gro_prepare_receive(struct sock *sk, ++ struct list_head *head, ++ struct sk_buff *skb, ++ struct gro_remcsum *grc) + { +- struct sk_buff *pp = NULL; + struct sk_buff *p; + struct vxlanhdr *vh, *vh2; + unsigned int hlen, off_vx; +- int flush = 1; + struct vxlan_sock *vs = rcu_dereference_sk_user_data(sk); + __be32 flags; +- struct gro_remcsum grc; + +- skb_gro_remcsum_init(&grc); ++ skb_gro_remcsum_init(grc); + + off_vx = skb_gro_offset(skb); + hlen = off_vx + sizeof(*vh); + vh = skb_gro_header(skb, hlen, off_vx); + if (unlikely(!vh)) +- goto out; ++ return NULL; + + skb_gro_postpull_rcsum(skb, vh, sizeof(struct vxlanhdr)); + +@@ -749,12 +747,12 @@ static struct sk_buff *vxlan_gro_receive(struct sock *sk, + + if ((flags & VXLAN_HF_RCO) && (vs->flags & VXLAN_F_REMCSUM_RX)) { + vh = vxlan_gro_remcsum(skb, off_vx, vh, sizeof(struct vxlanhdr), +- vh->vx_vni, &grc, ++ vh->vx_vni, grc, + !!(vs->flags & + VXLAN_F_REMCSUM_NOPARTIAL)); + + if (!vh) +- goto out; ++ return NULL; + } + + skb_gro_pull(skb, sizeof(struct vxlanhdr)); /* pull vxlan header */ +@@ -771,12 +769,48 @@ static struct sk_buff *vxlan_gro_receive(struct sock *sk, + } + } + +- pp = call_gro_receive(eth_gro_receive, head, skb); +- flush = 0; ++ return vh; ++} ++ ++static struct sk_buff *vxlan_gro_receive(struct sock *sk, ++ struct list_head *head, ++ struct sk_buff *skb) ++{ ++ struct sk_buff *pp = NULL; ++ struct gro_remcsum grc; ++ int flush = 1; + +-out: ++ if (vxlan_gro_prepare_receive(sk, head, skb, &grc)) { ++ pp = call_gro_receive(eth_gro_receive, head, skb); ++ flush = 0; ++ } + skb_gro_flush_final_remcsum(skb, pp, flush, &grc); ++ return pp; ++} + ++static struct sk_buff *vxlan_gpe_gro_receive(struct sock *sk, ++ struct list_head *head, ++ struct sk_buff *skb) ++{ ++ const struct packet_offload *ptype; ++ struct sk_buff *pp = NULL; ++ struct gro_remcsum grc; ++ struct vxlanhdr *vh; ++ __be16 protocol; ++ int flush = 1; ++ ++ vh = vxlan_gro_prepare_receive(sk, head, skb, &grc); ++ if (vh) { ++ if (!vxlan_parse_gpe_proto(vh, &protocol)) ++ goto out; ++ ptype = gro_find_receive_by_type(protocol); ++ if (!ptype) ++ goto out; ++ pp = call_gro_receive(ptype->callbacks.gro_receive, head, skb); ++ flush = 0; ++ } ++out: ++ skb_gro_flush_final_remcsum(skb, pp, flush, &grc); + return pp; + } + +@@ -788,6 +822,21 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff) + return eth_gro_complete(skb, nhoff + sizeof(struct vxlanhdr)); + } + ++static int vxlan_gpe_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff) ++{ ++ struct vxlanhdr *vh = (struct vxlanhdr *)(skb->data + nhoff); ++ const struct packet_offload *ptype; ++ int err = -ENOSYS; ++ __be16 protocol; ++ ++ if (!vxlan_parse_gpe_proto(vh, &protocol)) ++ return err; ++ ptype = gro_find_complete_by_type(protocol); ++ if (ptype) ++ err = ptype->callbacks.gro_complete(skb, nhoff + sizeof(struct vxlanhdr)); ++ return err; ++} ++ + static struct vxlan_fdb *vxlan_fdb_alloc(struct vxlan_dev *vxlan, const u8 *mac, + __u16 state, __be32 src_vni, + __u16 ndm_flags) +@@ -3416,8 +3465,13 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6, + tunnel_cfg.encap_rcv = vxlan_rcv; + tunnel_cfg.encap_err_lookup = vxlan_err_lookup; + tunnel_cfg.encap_destroy = NULL; +- tunnel_cfg.gro_receive = vxlan_gro_receive; +- tunnel_cfg.gro_complete = vxlan_gro_complete; ++ if (vs->flags & VXLAN_F_GPE) { ++ tunnel_cfg.gro_receive = vxlan_gpe_gro_receive; ++ tunnel_cfg.gro_complete = vxlan_gpe_gro_complete; ++ } else { ++ tunnel_cfg.gro_receive = vxlan_gro_receive; ++ tunnel_cfg.gro_complete = vxlan_gro_complete; ++ } + + setup_udp_tunnel_sock(net, sock, &tunnel_cfg); + +-- +2.39.2 + diff --git a/queue-6.1/vxlan-generalize-vxlan_parse_gpe_hdr-and-remove-unus.patch b/queue-6.1/vxlan-generalize-vxlan_parse_gpe_hdr-and-remove-unus.patch new file mode 100644 index 00000000000..bdcc0e98573 --- /dev/null +++ b/queue-6.1/vxlan-generalize-vxlan_parse_gpe_hdr-and-remove-unus.patch @@ -0,0 +1,115 @@ +From e06acaa6d125d23aafba48e3cc2e7e1e78d1e60d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 16:30:46 +0200 +Subject: vxlan: generalize vxlan_parse_gpe_hdr and remove unused args + +From: Jiri Benc + +[ Upstream commit 17a0a64448b568442a101de09575f81ffdc45d15 ] + +The vxlan_parse_gpe_hdr function extracts the next protocol value from +the GPE header and marks GPE bits as parsed. + +In order to be used in the next patch, split the function into protocol +extraction and bit marking. The bit marking is meaningful only in +vxlan_rcv; move it directly there. + +Rename the function to vxlan_parse_gpe_proto to reflect what it now +does. Remove unused arguments skb and vxflags. Move the function earlier +in the file to allow it to be called from more places in the next patch. + +Signed-off-by: Jiri Benc +Signed-off-by: David S. Miller +Stable-dep-of: b0b672c4d095 ("vxlan: fix GRO with VXLAN-GPE") +Signed-off-by: Sasha Levin +--- + drivers/net/vxlan/vxlan_core.c | 58 ++++++++++++++++------------------ + 1 file changed, 28 insertions(+), 30 deletions(-) + +diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c +index 719f862fa55eb..0dc7326fd6ed4 100644 +--- a/drivers/net/vxlan/vxlan_core.c ++++ b/drivers/net/vxlan/vxlan_core.c +@@ -670,6 +670,32 @@ static int vxlan_fdb_append(struct vxlan_fdb *f, + return 1; + } + ++static bool vxlan_parse_gpe_proto(struct vxlanhdr *hdr, __be16 *protocol) ++{ ++ struct vxlanhdr_gpe *gpe = (struct vxlanhdr_gpe *)hdr; ++ ++ /* Need to have Next Protocol set for interfaces in GPE mode. */ ++ if (!gpe->np_applied) ++ return false; ++ /* "The initial version is 0. If a receiver does not support the ++ * version indicated it MUST drop the packet. ++ */ ++ if (gpe->version != 0) ++ return false; ++ /* "When the O bit is set to 1, the packet is an OAM packet and OAM ++ * processing MUST occur." However, we don't implement OAM ++ * processing, thus drop the packet. ++ */ ++ if (gpe->oam_flag) ++ return false; ++ ++ *protocol = tun_p_to_eth_p(gpe->next_protocol); ++ if (!*protocol) ++ return false; ++ ++ return true; ++} ++ + static struct vxlanhdr *vxlan_gro_remcsum(struct sk_buff *skb, + unsigned int off, + struct vxlanhdr *vh, size_t hdrlen, +@@ -1572,35 +1598,6 @@ static void vxlan_parse_gbp_hdr(struct vxlanhdr *unparsed, + unparsed->vx_flags &= ~VXLAN_GBP_USED_BITS; + } + +-static bool vxlan_parse_gpe_hdr(struct vxlanhdr *unparsed, +- __be16 *protocol, +- struct sk_buff *skb, u32 vxflags) +-{ +- struct vxlanhdr_gpe *gpe = (struct vxlanhdr_gpe *)unparsed; +- +- /* Need to have Next Protocol set for interfaces in GPE mode. */ +- if (!gpe->np_applied) +- return false; +- /* "The initial version is 0. If a receiver does not support the +- * version indicated it MUST drop the packet. +- */ +- if (gpe->version != 0) +- return false; +- /* "When the O bit is set to 1, the packet is an OAM packet and OAM +- * processing MUST occur." However, we don't implement OAM +- * processing, thus drop the packet. +- */ +- if (gpe->oam_flag) +- return false; +- +- *protocol = tun_p_to_eth_p(gpe->next_protocol); +- if (!*protocol) +- return false; +- +- unparsed->vx_flags &= ~VXLAN_GPE_USED_BITS; +- return true; +-} +- + static bool vxlan_set_mac(struct vxlan_dev *vxlan, + struct vxlan_sock *vs, + struct sk_buff *skb, __be32 vni) +@@ -1702,8 +1699,9 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) + * used by VXLAN extensions if explicitly requested. + */ + if (vs->flags & VXLAN_F_GPE) { +- if (!vxlan_parse_gpe_hdr(&unparsed, &protocol, skb, vs->flags)) ++ if (!vxlan_parse_gpe_proto(&unparsed, &protocol)) + goto drop; ++ unparsed.vx_flags &= ~VXLAN_GPE_USED_BITS; + raw_proto = true; + } + +-- +2.39.2 + diff --git a/queue-6.1/x86-traps-fix-load_unaligned_zeropad-handling-for-sh.patch b/queue-6.1/x86-traps-fix-load_unaligned_zeropad-handling-for-sh.patch new file mode 100644 index 00000000000..db9560554e7 --- /dev/null +++ b/queue-6.1/x86-traps-fix-load_unaligned_zeropad-handling-for-sh.patch @@ -0,0 +1,95 @@ +From 02a908ca8be8a57f89bd14807df810eb7dc780d5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jul 2023 02:03:29 +0300 +Subject: x86/traps: Fix load_unaligned_zeropad() handling for shared TDX + memory + +From: Kirill A. Shutemov + +[ Upstream commit 9f9116406120638b4d8db3831ffbc430dd2e1e95 ] + +Commit c4e34dd99f2e ("x86: simplify load_unaligned_zeropad() +implementation") changes how exceptions around load_unaligned_zeropad() +handled. The kernel now uses the fault_address in fixup_exception() to +verify the address calculations for the load_unaligned_zeropad(). + +It works fine for #PF, but breaks on #VE since no fault address is +passed down to fixup_exception(). + +Propagating ve_info.gla down to fixup_exception() resolves the issue. + +See commit 1e7769653b06 ("x86/tdx: Handle load_unaligned_zeropad() +page-cross to a shared page") for more context. + +Signed-off-by: Kirill A. Shutemov +Reported-by: Michael Kelley +Fixes: c4e34dd99f2e ("x86: simplify load_unaligned_zeropad() implementation") +Acked-by: Dave Hansen +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/traps.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c +index d3fdec706f1d2..c0a5a4f225d9a 100644 +--- a/arch/x86/kernel/traps.c ++++ b/arch/x86/kernel/traps.c +@@ -697,9 +697,10 @@ static bool try_fixup_enqcmd_gp(void) + } + + static bool gp_try_fixup_and_notify(struct pt_regs *regs, int trapnr, +- unsigned long error_code, const char *str) ++ unsigned long error_code, const char *str, ++ unsigned long address) + { +- if (fixup_exception(regs, trapnr, error_code, 0)) ++ if (fixup_exception(regs, trapnr, error_code, address)) + return true; + + current->thread.error_code = error_code; +@@ -759,7 +760,7 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_protection) + goto exit; + } + +- if (gp_try_fixup_and_notify(regs, X86_TRAP_GP, error_code, desc)) ++ if (gp_try_fixup_and_notify(regs, X86_TRAP_GP, error_code, desc, 0)) + goto exit; + + if (error_code) +@@ -1357,17 +1358,20 @@ DEFINE_IDTENTRY(exc_device_not_available) + + #define VE_FAULT_STR "VE fault" + +-static void ve_raise_fault(struct pt_regs *regs, long error_code) ++static void ve_raise_fault(struct pt_regs *regs, long error_code, ++ unsigned long address) + { + if (user_mode(regs)) { + gp_user_force_sig_segv(regs, X86_TRAP_VE, error_code, VE_FAULT_STR); + return; + } + +- if (gp_try_fixup_and_notify(regs, X86_TRAP_VE, error_code, VE_FAULT_STR)) ++ if (gp_try_fixup_and_notify(regs, X86_TRAP_VE, error_code, ++ VE_FAULT_STR, address)) { + return; ++ } + +- die_addr(VE_FAULT_STR, regs, error_code, 0); ++ die_addr(VE_FAULT_STR, regs, error_code, address); + } + + /* +@@ -1431,7 +1435,7 @@ DEFINE_IDTENTRY(exc_virtualization_exception) + * it successfully, treat it as #GP(0) and handle it. + */ + if (!tdx_handle_virt_exception(regs, &ve)) +- ve_raise_fault(regs, 0); ++ ve_raise_fault(regs, 0, ve.gla); + + cond_local_irq_disable(regs); + } +-- +2.39.2 +