History

Merge tag 'net-6.2-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski: "Including fixes from wireless, bluetooth, bpf and netfilter. Current release - regressions: - Revert "net: team: use IFF_NO_ADDRCONF flag to prevent ipv6 addrconf", fix nsna_ping mode of team - wifi: mt76: fix bugs in Rx queue handling and DMA mapping - eth: mlx5: - add missing mutex_unlock in error reporter - protect global IPsec ASO with a lock Current release - new code bugs: - rxrpc: fix wrong error return in rxrpc_connect_call() Previous releases - regressions: - bluetooth: hci_sync: fix use of HCI_OP_LE_READ_BUFFER_SIZE_V2 - wifi: - mac80211: fix crashes on Rx due to incorrect initialization of rx->link and rx->link_sta - mac80211: fix bugs in iTXQ conversion - Tx stalls, incorrect aggregation handling, crashes - brcmfmac: fix regression for Broadcom PCIe wifi devices - rndis_wlan: prevent buffer overflow in rndis_query_oid - netfilter: conntrack: handle tcp challenge acks during connection reuse - sched: avoid grafting on htb_destroy_class_offload when destroying - virtio-net: correctly enable callback during start_xmit, fix stalls - tcp: avoid the lookup process failing to get sk in ehash table - ipa: disable ipa interrupt during suspend - eth: stmmac: enable all safety features by default Previous releases - always broken: - bpf: - fix pointer-leak due to insufficient speculative store bypass mitigation (Spectre v4) - skip task with pid=1 in send_signal_common() to avoid a splat - fix BPF program ID information in BPF_AUDIT_UNLOAD as well as PERF_BPF_EVENT_PROG_UNLOAD events - fix potential deadlock in htab_lock_bucket from same bucket index but different map_locked index - bluetooth: - fix a buffer overflow in mgmt_mesh_add() - hci_qca: fix driver shutdown on closed serdev - ISO: fix possible circular locking dependency - CIS: hci_event: fix invalid wait context - wifi: brcmfmac: fixes for survey dump handling - mptcp: explicitly specify sock family at subflow creation time - netfilter: nft_payload: incorrect arithmetics when fetching VLAN header bits - tcp: fix rate_app_limited to default to 1 - l2tp: close all race conditions in l2tp_tunnel_register() - eth: mlx5: fixes for QoS config and eswitch configuration - eth: enetc: avoid deadlock in enetc_tx_onestep_tstamp() - eth: stmmac: fix invalid call to mdiobus_get_phy() Misc: - ethtool: add netlink attr in rss get reply only if the value is not empty" * tag 'net-6.2-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (88 commits) Revert "Merge branch 'octeontx2-af-CPT'" tcp: fix rate_app_limited to default to 1 bnxt: Do not read past the end of test names net: stmmac: enable all safety features by default octeontx2-af: add mbox to return CPT_AF_FLT_INT info octeontx2-af: update cpt lf alloc mailbox octeontx2-af: restore rxc conf after teardown sequence octeontx2-af: optimize cpt pf identification octeontx2-af: modify FLR sequence for CPT octeontx2-af: add mbox for CPT LF reset octeontx2-af: recover CPT engine when it gets fault net: dsa: microchip: ksz9477: port map correction in ALU table entry register selftests/net: toeplitz: fix race on tpacket_v3 block close net/ulp: use consistent error code when blocking ULP octeontx2-pf: Fix the use of GFP_KERNEL in atomic context on rt tcp: avoid the lookup process failing to get sk in ehash table Revert "net: team: use IFF_NO_ADDRCONF flag to prevent ipv6 addrconf" MAINTAINERS: add networking entries for Willem net: sched: gred: prevent races when adding offloads to stats l2tp: prevent lockdep issue in l2tp_tunnel_register() ...

Linus Torvalds committed 3 years ago

Commit 5deaa982 parents 4a0c7a6 45a919b90 files · +804 −560Browse files

Unified · Split

90 files
  1. MAINTAINERS +20 −1
  2. drivers/bluetooth/hci_qca.c +7 −0
  3. drivers/net/dsa/microchip/ksz9477.c +2 −2
  4. drivers/net/ethernet/amd/xgbe/xgbe-dev.c +15 −8
  5. drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +24 −0
  6. drivers/net/ethernet/amd/xgbe/xgbe.h +2 −0
  7. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +4 −9
  8. drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h +1 −8
  9. drivers/net/ethernet/cadence/macb_main.c +1 −8
  10. drivers/net/ethernet/freescale/enetc/enetc.c +2 −2
  11. drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +2 −9
  12. drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +2 −0
  13. drivers/net/ethernet/mellanox/mlx5/core/en/htb.c +2 −2
  14. drivers/net/ethernet/mellanox/mlx5/core/en/params.c +1 −2
  15. drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c +2 −3
  16. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h +2 −5
  17. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c +6 −6
  18. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +3 −0
  19. drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +3 −15
  20. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +1 −0
  21. drivers/net/ethernet/mellanox/mlx5/core/health.c +1 −0
  22. drivers/net/ethernet/mellanox/mlx5/core/main.c +4 −4
  23. drivers/net/ethernet/mellanox/mlx5/core/qos.c +1 −2
  24. drivers/net/ethernet/mellanox/mlx5/core/qos.h +1 −1
  25. drivers/net/ethernet/microchip/lan966x/lan966x_main.c +8 −5
  26. drivers/net/ethernet/stmicro/stmmac/dwmac5.c +14 −0
  27. drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +4 −4
  28. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 −0
  29. drivers/net/ipa/ipa_interrupt.c +10 −0
  30. drivers/net/ipa/ipa_interrupt.h +16 −0
  31. drivers/net/ipa/ipa_power.c +17 −0
  32. drivers/net/phy/mdio_bus.c +6 −1
  33. drivers/net/team/team.c +0 −2
  34. drivers/net/usb/sr9700.c +1 −1
  35. drivers/net/virtio_net.c +4 −2
  36. drivers/net/wan/fsl_ucc_hdlc.c +4 −2
  37. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +19 −18
  38. drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +1 −1
  39. drivers/net/wireless/mediatek/mt76/dma.c +80 −51
  40. drivers/net/wireless/mediatek/mt76/mt7915/mmio.c +7 −0
  41. drivers/net/wireless/mediatek/mt76/tx.c +4 −3
  42. drivers/net/wireless/rndis_wlan.c +6 −13
  43. include/linux/bpf.h +1 −1
  44. include/net/mac80211.h +0 −4
  45. include/net/sch_generic.h +7 −0
  46. kernel/bpf/hashtab.c +2 −2
  47. kernel/bpf/offload.c +0 −3
  48. kernel/bpf/syscall.c +7 −17
  49. kernel/bpf/verifier.c +9 −1
  50. kernel/trace/bpf_trace.c +3 −0
  51. net/bluetooth/hci_conn.c +14 −4
  52. net/bluetooth/hci_event.c +4 −1
  53. net/bluetooth/hci_sync.c +6 −13
  54. net/bluetooth/iso.c +26 −38
  55. net/bluetooth/mgmt_util.h +1 −1
  56. net/bluetooth/rfcomm/sock.c +6 −1
  57. net/ethtool/rss.c +7 −4
  58. net/ipv4/inet_hashtables.c +15 −2
  59. net/ipv4/inet_timewait_sock.c +4 −4
  60. net/ipv4/tcp.c +2 −0
  61. net/ipv4/tcp_ulp.c +1 −1
  62. net/l2tp/l2tp_core.c +50 −52
  63. net/mac80211/agg-tx.c +5 −3
  64. net/mac80211/cfg.c +7 −0
  65. net/mac80211/debugfs_sta.c +3 −2
  66. net/mac80211/driver-ops.c +3 −0
  67. net/mac80211/driver-ops.h +1 −1
  68. net/mac80211/ht.c +31 −0
  69. net/mac80211/ieee80211_i.h +1 −1
  70. net/mac80211/iface.c +3 −2
  71. net/mac80211/rx.c +102 −123
  72. net/mac80211/tx.c +17 −17
  73. net/mac80211/util.c +3 −39
  74. net/mptcp/pm.c +25 −0
  75. net/mptcp/pm_userspace.c +7 −0
  76. net/mptcp/protocol.c +1 −1
  77. net/mptcp/protocol.h +5 −1
  78. net/mptcp/subflow.c +5 −4
  79. net/netfilter/ipset/ip_set_bitmap_ip.c +2 −2
  80. net/netfilter/nf_conntrack_proto_tcp.c +15 −0
  81. net/netfilter/nft_payload.c +1 −1
  82. net/nfc/llcp_core.c +1 −0
  83. net/rxrpc/call_object.c +1 −1
  84. net/sched/sch_gred.c +2 −0
  85. net/sched/sch_htb.c +16 −11
  86. net/sched/sch_taprio.c +3 −0
  87. tools/testing/selftests/net/mptcp/userspace_pm.sh +47 −0
  88. tools/testing/selftests/net/toeplitz.c +7 −5
  89. tools/testing/selftests/netfilter/nft_trans_stress.sh +9 −7
  90. tools/testing/selftests/netfilter/settings +1 −0
MAINTAINERS+20−1
@@ -1104,7 +1104,6 @@ S: Supported · 1103 unmodified lines
11041104 F: arch/arm64/boot/dts/amd/
11051105
11061106 AMD XGBE DRIVER
1107−M: Tom Lendacky <thomas.lendacky@amd.com>
11081107 M: "Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>
11091108 L: netdev@vger.kernel.org
11101109 S: Supported
@@ -15750,6 +15749,12 @@ S: Maintained · 14639 unmodified lines
1575015749 W: https://wireless.wiki.kernel.org/en/users/Drivers/p54
1575115750 F: drivers/net/wireless/intersil/p54/
1575215751
15752+PACKET SOCKETS
15753+M: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
15754+S: Maintained
15755+F: include/uapi/linux/if_packet.h
15756+F: net/packet/af_packet.c
15757+
1575315758 PACKING
1575415759 M: Vladimir Oltean <olteanv@gmail.com>
1575515760 L: netdev@vger.kernel.org
@@ -19326,6 +19331,13 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers) · 3570 unmodified lines
1932619331 S: Orphan
1932719332 F: sound/soc/uniphier/
1932819333
19334+SOCKET TIMESTAMPING
19335+M: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
19336+S: Maintained
19337+F: Documentation/networking/timestamping.rst
19338+F: include/uapi/linux/net_tstamp.h
19339+F: tools/testing/selftests/net/so_txtime.c
19340+
1932919341 SOEKRIS NET48XX LED SUPPORT
1933019342 M: Chris Boot <bootc@bootc.net>
1933119343 S: Maintained
@@ -21746,6 +21758,13 @@ T: git git://linuxtv.org/media_tree.git · 2414 unmodified lines
2174621758 F: Documentation/admin-guide/media/zr364xx*
2174721759 F: drivers/staging/media/deprecated/zr364xx/
2174821760
21761+USER DATAGRAM PROTOCOL (UDP)
21762+M: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
21763+S: Maintained
21764+F: include/linux/udp.h
21765+F: net/ipv4/udp.c
21766+F: net/ipv6/udp.c
21767+
2174921768 USER-MODE LINUX (UML)
2175021769 M: Richard Weinberger <richard@nod.at>
2175121770 M: Anton Ivanov <anton.ivanov@cambridgegreys.com>
drivers/bluetooth/hci_qca.c+7−0
@@ -2164,10 +2164,17 @@ static void qca_serdev_shutdown(struct device *dev) · 2163 unmodified lines
21642164 int timeout = msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS);
21652165 struct serdev_device *serdev = to_serdev_device(dev);
21662166 struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
2167+ struct hci_uart *hu = &qcadev->serdev_hu;
2168+ struct hci_dev *hdev = hu->hdev;
2169+ struct qca_data *qca = hu->priv;
21672170 const u8 ibs_wake_cmd[] = { 0xFD };
21682171 const u8 edl_reset_soc_cmd[] = { 0x01, 0x00, 0xFC, 0x01, 0x05 };
21692172
21702173 if (qcadev->btsoc_type == QCA_QCA6390) {
2174+ if (test_bit(QCA_BT_OFF, &qca->flags) ||
2175+ !test_bit(HCI_RUNNING, &hdev->flags))
2176+ return;
2177+
21712178 serdev_device_write_flush(serdev);
21722179 ret = serdev_device_write_buf(serdev, ibs_wake_cmd,
21732180 sizeof(ibs_wake_cmd));
drivers/net/dsa/microchip/ksz9477.c+2−2
@@ -540,10 +540,10 @@ int ksz9477_fdb_del(struct ksz_device *dev, int port, · 539 unmodified lines
540540 ksz_read32(dev, REG_SW_ALU_VAL_D, &alu_table[3]);
541541
542542 /* clear forwarding port */
543− alu_table[2] &= ~BIT(port);
543+ alu_table[1] &= ~BIT(port);
544544
545545 /* if there is no port to forward, clear table */
546− if ((alu_table[2] & ALU_V_PORT_MAP) == 0) {
546+ if ((alu_table[1] & ALU_V_PORT_MAP) == 0) {
547547 alu_table[0] = 0;
548548 alu_table[1] = 0;
549549 alu_table[2] = 0;
drivers/net/ethernet/amd/xgbe/xgbe-dev.c+15−8
@@ -524,19 +524,28 @@ static void xgbe_disable_vxlan(struct xgbe_prv_data *pdata) · 523 unmodified lines
524524 netif_dbg(pdata, drv, pdata->netdev, "VXLAN acceleration disabled\n");
525525 }
526526
527+static unsigned int xgbe_get_fc_queue_count(struct xgbe_prv_data *pdata)
528+{
529+ unsigned int max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;
530+
531+ /* From MAC ver 30H the TFCR is per priority, instead of per queue */
532+ if (XGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER) >= 0x30)
533+ return max_q_count;
534+ else
535+ return min_t(unsigned int, pdata->tx_q_count, max_q_count);
536+}
537+
527538 static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata)
528539 {
529− unsigned int max_q_count, q_count;
530540 unsigned int reg, reg_val;
531− unsigned int i;
541+ unsigned int i, q_count;
532542
533543 /* Clear MTL flow control */
534544 for (i = 0; i < pdata->rx_q_count; i++)
535545 XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, 0);
536546
537547 /* Clear MAC flow control */
538− max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;
539− q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count);
548+ q_count = xgbe_get_fc_queue_count(pdata);
540549 reg = MAC_Q0TFCR;
541550 for (i = 0; i < q_count; i++) {
542551 reg_val = XGMAC_IOREAD(pdata, reg);
@@ -553,9 +562,8 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata) · 10 unmodified lines
553562 {
554563 struct ieee_pfc *pfc = pdata->pfc;
555564 struct ieee_ets *ets = pdata->ets;
556− unsigned int max_q_count, q_count;
557565 unsigned int reg, reg_val;
558− unsigned int i;
566+ unsigned int i, q_count;
559567
560568 /* Set MTL flow control */
561569 for (i = 0; i < pdata->rx_q_count; i++) {
@@ -579,8 +587,7 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata) · 17 unmodified lines
579587 }
580588
581589 /* Set MAC flow control */
582− max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES;
583− q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count);
590+ q_count = xgbe_get_fc_queue_count(pdata);
584591 reg = MAC_Q0TFCR;
585592 for (i = 0; i < q_count; i++) {
586593 reg_val = XGMAC_IOREAD(pdata, reg);
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c+24−0
@@ -496,6 +496,7 @@ static enum xgbe_an xgbe_an73_tx_training(struct xgbe_prv_data *pdata, · 495 unmodified lines
496496 reg |= XGBE_KR_TRAINING_ENABLE;
497497 reg |= XGBE_KR_TRAINING_START;
498498 XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg);
499+ pdata->kr_start_time = jiffies;
499500
500501 netif_dbg(pdata, link, pdata->netdev,
501502 "KR training initiated\n");
@@ -632,6 +633,8 @@ static enum xgbe_an xgbe_an73_incompat_link(struct xgbe_prv_data *pdata) · 130 unmodified lines
632633
633634 xgbe_switch_mode(pdata);
634635
636+ pdata->an_result = XGBE_AN_READY;
637+
635638 xgbe_an_restart(pdata);
636639
637640 return XGBE_AN_INCOMPAT_LINK;
@@ -1275,9 +1278,30 @@ static bool xgbe_phy_aneg_done(struct xgbe_prv_data *pdata) · 637 unmodified lines
12751278 static void xgbe_check_link_timeout(struct xgbe_prv_data *pdata)
12761279 {
12771280 unsigned long link_timeout;
1281+ unsigned long kr_time;
1282+ int wait;
12781283
12791284 link_timeout = pdata->link_check + (XGBE_LINK_TIMEOUT * HZ);
12801285 if (time_after(jiffies, link_timeout)) {
1286+ if ((xgbe_cur_mode(pdata) == XGBE_MODE_KR) &&
1287+ pdata->phy.autoneg == AUTONEG_ENABLE) {
1288+ /* AN restart should not happen while KR training is in progress.
1289+ * The while loop ensures no AN restart during KR training,
1290+ * waits up to 500ms and AN restart is triggered only if KR
1291+ * training is failed.
1292+ */
1293+ wait = XGBE_KR_TRAINING_WAIT_ITER;
1294+ while (wait--) {
1295+ kr_time = pdata->kr_start_time +
1296+ msecs_to_jiffies(XGBE_AN_MS_TIMEOUT);
1297+ if (time_after(jiffies, kr_time))
1298+ break;
1299+ /* AN restart is not required, if AN result is COMPLETE */
1300+ if (pdata->an_result == XGBE_AN_COMPLETE)
1301+ return;
1302+ usleep_range(10000, 11000);
1303+ }
1304+ }
12811305 netif_dbg(pdata, link, pdata->netdev, "AN link timeout\n");
12821306 xgbe_phy_config_aneg(pdata);
12831307 }
drivers/net/ethernet/amd/xgbe/xgbe.h+2−0
@@ -290,6 +290,7 @@ · 289 unmodified lines
290290 /* Auto-negotiation */
291291 #define XGBE_AN_MS_TIMEOUT 500
292292 #define XGBE_LINK_TIMEOUT 5
293+#define XGBE_KR_TRAINING_WAIT_ITER 50
293294
294295 #define XGBE_SGMII_AN_LINK_STATUS BIT(1)
295296 #define XGBE_SGMII_AN_LINK_SPEED (BIT(2) | BIT(3))
@@ -1280,6 +1281,7 @@ struct xgbe_prv_data { · 984 unmodified lines
12801281 unsigned int parallel_detect;
12811282 unsigned int fec_ability;
12821283 unsigned long an_start;
1284+ unsigned long kr_start_time;
12831285 enum xgbe_an_mode an_mode;
12841286
12851287 /* I2C support */
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+4−9
@@ -3969,7 +3969,7 @@ void bnxt_ethtool_init(struct bnxt *bp) · 3968 unmodified lines
39693969 test_info->timeout = HWRM_CMD_TIMEOUT;
39703970 for (i = 0; i < bp->num_tests; i++) {
39713971 char *str = test_info->string[i];
3972− char *fw_str = resp->test0_name + i * 32;
3972+ char *fw_str = resp->test_name[i];
39733973
39743974 if (i == BNXT_MACLPBK_TEST_IDX) {
39753975 strcpy(str, "Mac loopback test (offline)");
@@ -3980,14 +3980,9 @@ void bnxt_ethtool_init(struct bnxt *bp) · 4 unmodified lines
39803980 } else if (i == BNXT_IRQ_TEST_IDX) {
39813981 strcpy(str, "Interrupt_test (offline)");
39823982 } else {
3983− strscpy(str, fw_str, ETH_GSTRING_LEN);
3984− strncat(str, " test", ETH_GSTRING_LEN - strlen(str));
3985− if (test_info->offline_mask & (1 << i))
3986− strncat(str, " (offline)",
3987− ETH_GSTRING_LEN - strlen(str));
3988− else
3989− strncat(str, " (online)",
3990− ETH_GSTRING_LEN - strlen(str));
3983+ snprintf(str, ETH_GSTRING_LEN, "%s test (%s)",
3984+ fw_str, test_info->offline_mask & (1 << i) ?
3985+ "offline" : "online");
39913986 }
39923987 }
39933988
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h+1−8
@@ -10249,14 +10249,7 @@ struct hwrm_selftest_qlist_output { · 10248 unmodified lines
1024910249 u8 unused_0;
1025010250 __le16 test_timeout;
1025110251 u8 unused_1[2];
10252− char test0_name[32];
10253− char test1_name[32];
10254− char test2_name[32];
10255− char test3_name[32];
10256− char test4_name[32];
10257− char test5_name[32];
10258− char test6_name[32];
10259− char test7_name[32];
10252+ char test_name[8][32];
1026010253 u8 eyescope_target_BER_support;
1026110254 #define SELFTEST_QLIST_RESP_EYESCOPE_TARGET_BER_SUPPORT_BER_1E8_SUPPORTED 0x0UL
1026210255 #define SELFTEST_QLIST_RESP_EYESCOPE_TARGET_BER_SUPPORT_BER_1E9_SUPPORTED 0x1UL
drivers/net/ethernet/cadence/macb_main.c+1−8
@@ -2187,7 +2187,6 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) · 2186 unmodified lines
21872187 bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) ||
21882188 skb_is_nonlinear(*skb);
21892189 int padlen = ETH_ZLEN - (*skb)->len;
2190− int headroom = skb_headroom(*skb);
21912190 int tailroom = skb_tailroom(*skb);
21922191 struct sk_buff *nskb;
21932192 u32 fcs;
@@ -2201,9 +2200,6 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) · 7 unmodified lines
22012200 /* FCS could be appeded to tailroom. */
22022201 if (tailroom >= ETH_FCS_LEN)
22032202 goto add_fcs;
2204− /* FCS could be appeded by moving data to headroom. */
2205− else if (!cloned && headroom + tailroom >= ETH_FCS_LEN)
2206− padlen = 0;
22072203 /* No room for FCS, need to reallocate skb. */
22082204 else
22092205 padlen = ETH_FCS_LEN;
@@ -2212,10 +2208,7 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) · 2 unmodified lines
22122208 padlen += ETH_FCS_LEN;
22132209 }
22142210
2215− if (!cloned && headroom + tailroom >= padlen) {
2216− (*skb)->data = memmove((*skb)->head, (*skb)->data, (*skb)->len);
2217− skb_set_tail_pointer(*skb, (*skb)->len);
2218− } else {
2211+ if (cloned || tailroom < padlen) {
22192212 nskb = skb_copy_expand(*skb, 0, padlen, GFP_ATOMIC);
22202213 if (!nskb)
22212214 return -ENOMEM;
drivers/net/ethernet/freescale/enetc/enetc.c+2−2
@@ -2290,14 +2290,14 @@ static void enetc_tx_onestep_tstamp(struct work_struct *work) · 2289 unmodified lines
22902290
22912291 priv = container_of(work, struct enetc_ndev_priv, tx_onestep_tstamp);
22922292
2293− netif_tx_lock(priv->ndev);
2293+ netif_tx_lock_bh(priv->ndev);
22942294
22952295 clear_bit_unlock(ENETC_TX_ONESTEP_TSTAMP_IN_PROGRESS, &priv->flags);
22962296 skb = skb_dequeue(&priv->tx_skbs);
22972297 if (skb)
22982298 enetc_start_xmit(skb, priv->ndev);
22992299
2300− netif_tx_unlock(priv->ndev);
2300+ netif_tx_unlock_bh(priv->ndev);
23012301 }
23022302
23032303 static void enetc_tx_onestep_tstamp_init(struct enetc_ndev_priv *priv)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c+2−9
@@ -1012,7 +1012,6 @@ static void otx2_pool_refill_task(struct work_struct *work) · 1011 unmodified lines
10121012 rbpool = cq->rbpool;
10131013 free_ptrs = cq->pool_ptrs;
10141014
1015− get_cpu();
10161015 while (cq->pool_ptrs) {
10171016 if (otx2_alloc_rbuf(pfvf, rbpool, &bufptr)) {
10181017 /* Schedule a WQ if we fails to free atleast half of the
@@ -1032,7 +1031,6 @@ static void otx2_pool_refill_task(struct work_struct *work) · 13 unmodified lines
10321031 pfvf->hw_ops->aura_freeptr(pfvf, qidx, bufptr + OTX2_HEAD_ROOM);
10331032 cq->pool_ptrs--;
10341033 }
1035− put_cpu();
10361034 cq->refill_task_sched = false;
10371035 }
10381036
@@ -1370,7 +1368,6 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) · 331 unmodified lines
13701368 if (err)
13711369 goto fail;
13721370
1373− get_cpu();
13741371 /* Allocate pointers and free them to aura/pool */
13751372 for (qidx = 0; qidx < hw->tot_tx_queues; qidx++) {
13761373 pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx);
@@ -1394,7 +1391,6 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) · 17 unmodified lines
13941391 }
13951392
13961393 err_mem:
1397− put_cpu();
13981394 return err ? -ENOMEM : 0;
13991395
14001396 fail:
@@ -1435,21 +1431,18 @@ int otx2_rq_aura_pool_init(struct otx2_nic *pfvf) · 34 unmodified lines
14351431 if (err)
14361432 goto fail;
14371433
1438− get_cpu();
14391434 /* Allocate pointers and free them to aura/pool */
14401435 for (pool_id = 0; pool_id < hw->rqpool_cnt; pool_id++) {
14411436 pool = &pfvf->qset.pool[pool_id];
14421437 for (ptr = 0; ptr < num_ptrs; ptr++) {
14431438 err = otx2_alloc_rbuf(pfvf, pool, &bufptr);
14441439 if (err)
1445− goto err_mem;
1440+ return -ENOMEM;
14461441 pfvf->hw_ops->aura_freeptr(pfvf, pool_id,
14471442 bufptr + OTX2_HEAD_ROOM);
14481443 }
14491444 }
1450−err_mem:
1451− put_cpu();
1452− return err ? -ENOMEM : 0;
1445+ return 0;
14531446 fail:
14541447 otx2_mbox_reset(&pfvf->mbox.mbox, 0);
14551448 otx2_aura_pool_free(pfvf);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h+2−0
@@ -736,8 +736,10 @@ static inline void cn10k_aura_freeptr(void *dev, int aura, u64 buf) · 735 unmodified lines
736736 u64 ptrs[2];
737737
738738 ptrs[1] = buf;
739+ get_cpu();
739740 /* Free only one buffer at time during init and teardown */
740741 __cn10k_aura_freeptr(pfvf, aura, ptrs, 2);
742+ put_cpu();
741743 }
742744
743745 /* Alloc pointer from pool/aura */
drivers/net/ethernet/mellanox/mlx5/core/en/htb.c+2−2
@@ -637,7 +637,7 @@ mlx5e_htb_update_children(struct mlx5e_htb *htb, struct mlx5e_qos_node *node, · 636 unmodified lines
637637 if (child->bw_share == old_bw_share)
638638 continue;
639639
640− err_one = mlx5_qos_update_node(htb->mdev, child->hw_id, child->bw_share,
640+ err_one = mlx5_qos_update_node(htb->mdev, child->bw_share,
641641 child->max_average_bw, child->hw_id);
642642 if (!err && err_one) {
643643 err = err_one;
@@ -671,7 +671,7 @@ mlx5e_htb_node_modify(struct mlx5e_htb *htb, u16 classid, u64 rate, u64 ceil, · 27 unmodified lines
671671 mlx5e_htb_convert_rate(htb, rate, node->parent, &bw_share);
672672 mlx5e_htb_convert_ceil(htb, ceil, &max_average_bw);
673673
674− err = mlx5_qos_update_node(htb->mdev, node->parent->hw_id, bw_share,
674+ err = mlx5_qos_update_node(htb->mdev, bw_share,
675675 max_average_bw, node->hw_id);
676676 if (err) {
677677 NL_SET_ERR_MSG_MOD(extack, "Firmware error when modifying a node.");
drivers/net/ethernet/mellanox/mlx5/core/en/params.c+1−2
@@ -578,7 +578,6 @@ int mlx5e_mpwrq_validate_xsk(struct mlx5_core_dev *mdev, struct mlx5e_params *pa · 577 unmodified lines
578578 {
579579 enum mlx5e_mpwrq_umr_mode umr_mode = mlx5e_mpwrq_umr_mode(mdev, xsk);
580580 u8 page_shift = mlx5e_mpwrq_page_shift(mdev, xsk);
581− bool unaligned = xsk ? xsk->unaligned : false;
582581 u16 max_mtu_pkts;
583582
584583 if (!mlx5e_check_fragmented_striding_rq_cap(mdev, page_shift, umr_mode))
@@ -591,7 +590,7 @@ int mlx5e_mpwrq_validate_xsk(struct mlx5_core_dev *mdev, struct mlx5e_params *pa · 6 unmodified lines
591590 * needed number of WQEs exceeds the maximum.
592591 */
593592 max_mtu_pkts = min_t(u8, MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE,
594− mlx5e_mpwrq_max_log_rq_pkts(mdev, page_shift, unaligned));
593+ mlx5e_mpwrq_max_log_rq_pkts(mdev, page_shift, xsk->unaligned));
595594 if (params->log_rq_mtu_frames > max_mtu_pkts) {
596595 mlx5_core_err(mdev, "Current RQ length %d is too big for XSK with given frame size %u\n",
597596 1 << params->log_rq_mtu_frames, xsk->chunk_size);
drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c+2−3
@@ -477,7 +477,6 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample, · 476 unmodified lines
477477 struct mlx5e_sample_flow *sample_flow;
478478 struct mlx5e_sample_attr *sample_attr;
479479 struct mlx5_flow_attr *pre_attr;
480− u32 tunnel_id = attr->tunnel_id;
481480 struct mlx5_eswitch *esw;
482481 u32 default_tbl_id;
483482 u32 obj_id;
@@ -522,7 +521,7 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample, · 38 unmodified lines
522521 restore_obj.sample.group_id = sample_attr->group_num;
523522 restore_obj.sample.rate = sample_attr->rate;
524523 restore_obj.sample.trunc_size = sample_attr->trunc_size;
525− restore_obj.sample.tunnel_id = tunnel_id;
524+ restore_obj.sample.tunnel_id = attr->tunnel_id;
526525 err = mapping_add(esw->offloads.reg_c0_obj_pool, &restore_obj, &obj_id);
527526 if (err)
528527 goto err_obj_id;
@@ -548,7 +547,7 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample, · 19 unmodified lines
548547 /* For decap action, do decap in the original flow table instead of the
549548 * default flow table.
550549 */
551− if (tunnel_id)
550+ if (attr->action & MLX5_FLOW_CONTEXT_ACTION_DECAP)
552551 pre_attr->action |= MLX5_FLOW_CONTEXT_ACTION_DECAP;
553552 pre_attr->modify_hdr = sample_flow->restore->modify_hdr;
554553 pre_attr->flags = MLX5_ATTR_FLAG_SAMPLE;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h+2−5
@@ -122,11 +122,8 @@ struct mlx5e_ipsec_aso { · 121 unmodified lines
122122 u8 ctx[MLX5_ST_SZ_BYTES(ipsec_aso)];
123123 dma_addr_t dma_addr;
124124 struct mlx5_aso *aso;
125− /* IPsec ASO caches data on every query call,
126− * so in nested calls, we can use this boolean to save
127− * recursive calls to mlx5e_ipsec_aso_query()
128− */
129− u8 use_cache : 1;
125+ /* Protect ASO WQ access, as it is global to whole IPsec */
126+ spinlock_t lock;
130127 };
131128
132129 struct mlx5e_ipsec {
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c+6−6
@@ -320,7 +320,6 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work) · 319 unmodified lines
320320 if (ret)
321321 goto unlock;
322322
323− aso->use_cache = true;
324323 if (attrs->esn_trigger &&
325324 !MLX5_GET(ipsec_aso, aso->ctx, esn_event_arm)) {
326325 u32 mode_param = MLX5_GET(ipsec_aso, aso->ctx, mode_parameter);
@@ -333,7 +332,6 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work) · 6 unmodified lines
333332 !MLX5_GET(ipsec_aso, aso->ctx, hard_lft_arm) ||
334333 !MLX5_GET(ipsec_aso, aso->ctx, remove_flow_enable))
335334 xfrm_state_check_expire(sa_entry->x);
336− aso->use_cache = false;
337335
338336 unlock:
339337 spin_unlock(&sa_entry->x->lock);
@@ -398,6 +396,7 @@ int mlx5e_ipsec_aso_init(struct mlx5e_ipsec *ipsec) · 58 unmodified lines
398396 goto err_aso_create;
399397 }
400398
399+ spin_lock_init(&aso->lock);
401400 ipsec->nb.notifier_call = mlx5e_ipsec_event;
402401 mlx5_notifier_register(mdev, &ipsec->nb);
403402
@@ -456,13 +455,12 @@ int mlx5e_ipsec_aso_query(struct mlx5e_ipsec_sa_entry *sa_entry, · 52 unmodified lines
456455 struct mlx5e_hw_objs *res;
457456 struct mlx5_aso_wqe *wqe;
458457 u8 ds_cnt;
458+ int ret;
459459
460460 lockdep_assert_held(&sa_entry->x->lock);
461− if (aso->use_cache)
462− return 0;
463−
464461 res = &mdev->mlx5e_res.hw_objs;
465462
463+ spin_lock_bh(&aso->lock);
466464 memset(aso->ctx, 0, sizeof(aso->ctx));
467465 wqe = mlx5_aso_get_wqe(aso->aso);
468466 ds_cnt = DIV_ROUND_UP(sizeof(*wqe), MLX5_SEND_WQE_DS);
@@ -477,7 +475,9 @@ int mlx5e_ipsec_aso_query(struct mlx5e_ipsec_sa_entry *sa_entry, · 8 unmodified lines
477475 mlx5e_ipsec_aso_copy(ctrl, data);
478476
479477 mlx5_aso_post_wqe(aso->aso, false, &wqe->ctrl);
480− return mlx5_aso_poll_cq(aso->aso, false);
478+ ret = mlx5_aso_poll_cq(aso->aso, false);
479+ spin_unlock_bh(&aso->lock);
480+ return ret;
481481 }
482482
483483 void mlx5e_ipsec_aso_update_curlft(struct mlx5e_ipsec_sa_entry *sa_entry,
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+3−0
@@ -166,6 +166,7 @@ struct mlx5_fs_chains *mlx5e_nic_chains(struct mlx5e_tc_table *tc) · 165 unmodified lines
166166 * it's different than the ht->mutex here.
167167 */
168168 static struct lock_class_key tc_ht_lock_key;
169+static struct lock_class_key tc_ht_wq_key;
169170
170171 static void mlx5e_put_flow_tunnel_id(struct mlx5e_tc_flow *flow);
171172 static void free_flow_post_acts(struct mlx5e_tc_flow *flow);
@@ -5182,6 +5183,7 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv) · 5010 unmodified lines
51825183 return err;
51835184
51845185 lockdep_set_class(&tc->ht.mutex, &tc_ht_lock_key);
5186+ lockdep_init_map(&tc->ht.run_work.lockdep_map, "tc_ht_wq_key", &tc_ht_wq_key, 0);
51855187
51865188 mapping_id = mlx5_query_nic_system_image_guid(dev);
51875189
@@ -5288,6 +5290,7 @@ int mlx5e_tc_ht_init(struct rhashtable *tc_ht) · 100 unmodified lines
52885290 return err;
52895291
52905292 lockdep_set_class(&tc_ht->mutex, &tc_ht_lock_key);
5293+ lockdep_init_map(&tc_ht->run_work.lockdep_map, "tc_ht_wq_key", &tc_ht_wq_key, 0);
52915294
52925295 return 0;
52935296 }
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c+3−15
@@ -22,15 +22,13 @@ struct mlx5_esw_rate_group { · 21 unmodified lines
2222 };
2323
2424 static int esw_qos_tsar_config(struct mlx5_core_dev *dev, u32 *sched_ctx,
25− u32 parent_ix, u32 tsar_ix,
26− u32 max_rate, u32 bw_share)
25+ u32 tsar_ix, u32 max_rate, u32 bw_share)
2726 {
2827 u32 bitmask = 0;
2928
3029 if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling))
3130 return -EOPNOTSUPP;
3231
33− MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_ix);
3432 MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_rate);
3533 MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share);
3634 bitmask |= MODIFY_SCHEDULING_ELEMENT_IN_MODIFY_BITMASK_MAX_AVERAGE_BW;
@@ -51,7 +49,7 @@ static int esw_qos_group_config(struct mlx5_eswitch *esw, struct mlx5_esw_rate_g · 14 unmodified lines
5149 int err;
5250
5351 err = esw_qos_tsar_config(dev, sched_ctx,
54− esw->qos.root_tsar_ix, group->tsar_ix,
52+ group->tsar_ix,
5553 max_rate, bw_share);
5654 if (err)
5755 NL_SET_ERR_MSG_MOD(extack, "E-Switch modify group TSAR element failed");
@@ -67,23 +65,13 @@ static int esw_qos_vport_config(struct mlx5_eswitch *esw, · 9 unmodified lines
6765 struct netlink_ext_ack *extack)
6866 {
6967 u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};
70− struct mlx5_esw_rate_group *group = vport->qos.group;
7168 struct mlx5_core_dev *dev = esw->dev;
72− u32 parent_tsar_ix;
73− void *vport_elem;
7469 int err;
7570
7671 if (!vport->qos.enabled)
7772 return -EIO;
7873
79− parent_tsar_ix = group ? group->tsar_ix : esw->qos.root_tsar_ix;
80− MLX5_SET(scheduling_context, sched_ctx, element_type,
81− SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT);
82− vport_elem = MLX5_ADDR_OF(scheduling_context, sched_ctx,
83− element_attributes);
84− MLX5_SET(vport_element, vport_elem, vport_number, vport->vport);
85−
86− err = esw_qos_tsar_config(dev, sched_ctx, parent_tsar_ix, vport->qos.esw_tsar_ix,
74+ err = esw_qos_tsar_config(dev, sched_ctx, vport->qos.esw_tsar_ix,
8775 max_rate, bw_share);
8876 if (err) {
8977 esw_warn(esw->dev,
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+1−0
@@ -1464,6 +1464,7 @@ void mlx5_eswitch_disable(struct mlx5_eswitch *esw) · 1463 unmodified lines
14641464 mlx5_lag_disable_change(esw->dev);
14651465 down_write(&esw->mode_lock);
14661466 mlx5_eswitch_disable_locked(esw);
1467+ esw->mode = MLX5_ESWITCH_LEGACY;
14671468 up_write(&esw->mode_lock);
14681469 mlx5_lag_enable_change(esw->dev);
14691470 }
drivers/net/ethernet/mellanox/mlx5/core/health.c+1−0
@@ -677,6 +677,7 @@ static void mlx5_fw_fatal_reporter_err_work(struct work_struct *work) · 676 unmodified lines
677677 mutex_lock(&dev->intf_state_mutex);
678678 if (test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) {
679679 mlx5_core_err(dev, "health works are not permitted at this stage\n");
680+ mutex_unlock(&dev->intf_state_mutex);
680681 return;
681682 }
682683 mutex_unlock(&dev->intf_state_mutex);
drivers/net/ethernet/mellanox/mlx5/core/main.c+4−4
@@ -2098,7 +2098,7 @@ static void mlx5_core_verify_params(void) · 2097 unmodified lines
20982098 }
20992099 }
21002100
2101−static int __init init(void)
2101+static int __init mlx5_init(void)
21022102 {
21032103 int err;
21042104
@@ -2133,7 +2133,7 @@ err_debug: · 28 unmodified lines
21332133 return err;
21342134 }
21352135
2136−static void __exit cleanup(void)
2136+static void __exit mlx5_cleanup(void)
21372137 {
21382138 mlx5e_cleanup();
21392139 mlx5_sf_driver_unregister();
@@ -2141,5 +2141,5 @@ static void __exit cleanup(void) · 1 unmodified line
21412141 mlx5_unregister_debugfs();
21422142 }
21432143
2144−module_init(init);
2145−module_exit(cleanup);
2144+module_init(mlx5_init);
2145+module_exit(mlx5_cleanup);
drivers/net/ethernet/mellanox/mlx5/core/qos.c+1−2
@@ -62,13 +62,12 @@ int mlx5_qos_create_root_node(struct mlx5_core_dev *mdev, u32 *id) · 61 unmodified lines
6262 return mlx5_qos_create_inner_node(mdev, MLX5_QOS_DEFAULT_DWRR_UID, 0, 0, id);
6363 }
6464
65−int mlx5_qos_update_node(struct mlx5_core_dev *mdev, u32 parent_id,
65+int mlx5_qos_update_node(struct mlx5_core_dev *mdev,
6666 u32 bw_share, u32 max_avg_bw, u32 id)
6767 {
6868 u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {0};
6969 u32 bitmask = 0;
7070
71− MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_id);
7271 MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share);
7372 MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_avg_bw);
7473
drivers/net/ethernet/mellanox/mlx5/core/qos.h+1−1
@@ -23,7 +23,7 @@ int mlx5_qos_create_leaf_node(struct mlx5_core_dev *mdev, u32 parent_id, · 22 unmodified lines
2323 int mlx5_qos_create_inner_node(struct mlx5_core_dev *mdev, u32 parent_id,
2424 u32 bw_share, u32 max_avg_bw, u32 *id);
2525 int mlx5_qos_create_root_node(struct mlx5_core_dev *mdev, u32 *id);
26−int mlx5_qos_update_node(struct mlx5_core_dev *mdev, u32 parent_id, u32 bw_share,
26+int mlx5_qos_update_node(struct mlx5_core_dev *mdev, u32 bw_share,
2727 u32 max_avg_bw, u32 id);
2828 int mlx5_qos_destroy_node(struct mlx5_core_dev *mdev, u32 id);
2929
drivers/net/ethernet/microchip/lan966x/lan966x_main.c+8−5
@@ -1043,11 +1043,6 @@ static int lan966x_probe(struct platform_device *pdev) · 1042 unmodified lines
10431043 lan966x->base_mac[5] &= 0xf0;
10441044 }
10451045
1046− ports = device_get_named_child_node(&pdev->dev, "ethernet-ports");
1047− if (!ports)
1048− return dev_err_probe(&pdev->dev, -ENODEV,
1049− "no ethernet-ports child found\n");
1050−
10511046 err = lan966x_create_targets(pdev, lan966x);
10521047 if (err)
10531048 return dev_err_probe(&pdev->dev, err,
@@ -1125,6 +1120,11 @@ static int lan966x_probe(struct platform_device *pdev) · 71 unmodified lines
11251120 }
11261121 }
11271122
1123+ ports = device_get_named_child_node(&pdev->dev, "ethernet-ports");
1124+ if (!ports)
1125+ return dev_err_probe(&pdev->dev, -ENODEV,
1126+ "no ethernet-ports child found\n");
1127+
11281128 /* init switch */
11291129 lan966x_init(lan966x);
11301130 lan966x_stats_init(lan966x);
@@ -1162,6 +1162,8 @@ static int lan966x_probe(struct platform_device *pdev) · 31 unmodified lines
11621162 goto cleanup_ports;
11631163 }
11641164
1165+ fwnode_handle_put(ports);
1166+
11651167 lan966x_mdb_init(lan966x);
11661168 err = lan966x_fdb_init(lan966x);
11671169 if (err)
@@ -1191,6 +1193,7 @@ cleanup_fdb: · 23 unmodified lines
11911193 lan966x_fdb_deinit(lan966x);
11921194
11931195 cleanup_ports:
1196+ fwnode_handle_put(ports);
11941197 fwnode_handle_put(portnp);
11951198
11961199 lan966x_cleanup_ports(lan966x);
drivers/net/ethernet/stmicro/stmmac/dwmac5.c+14−0
@@ -186,11 +186,25 @@ static void dwmac5_handle_dma_err(struct net_device *ndev, · 185 unmodified lines
186186 int dwmac5_safety_feat_config(void __iomem *ioaddr, unsigned int asp,
187187 struct stmmac_safety_feature_cfg *safety_feat_cfg)
188188 {
189+ struct stmmac_safety_feature_cfg all_safety_feats = {
190+ .tsoee = 1,
191+ .mrxpee = 1,
192+ .mestee = 1,
193+ .mrxee = 1,
194+ .mtxee = 1,
195+ .epsi = 1,
196+ .edpp = 1,
197+ .prtyen = 1,
198+ .tmouten = 1,
199+ };
189200 u32 value;
190201
191202 if (!asp)
192203 return -EINVAL;
193204
205+ if (!safety_feat_cfg)
206+ safety_feat_cfg = &all_safety_feats;
207+
194208 /* 1. Enable Safety Features */
195209 value = readl(ioaddr + MTL_ECC_CONTROL);
196210 value |= MEEAO; /* MTL ECC Error Addr Status Override */
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c+4−4
@@ -551,16 +551,16 @@ static void stmmac_get_per_qstats(struct stmmac_priv *priv, u64 *data) · 550 unmodified lines
551551 p = (char *)priv + offsetof(struct stmmac_priv,
552552 xstats.txq_stats[q].tx_pkt_n);
553553 for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) {
554− *data++ = (*(u64 *)p);
555− p += sizeof(u64 *);
554+ *data++ = (*(unsigned long *)p);
555+ p += sizeof(unsigned long);
556556 }
557557 }
558558 for (q = 0; q < rx_cnt; q++) {
559559 p = (char *)priv + offsetof(struct stmmac_priv,
560560 xstats.rxq_stats[q].rx_pkt_n);
561561 for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) {
562− *data++ = (*(u64 *)p);
563− p += sizeof(u64 *);
562+ *data++ = (*(unsigned long *)p);
563+ p += sizeof(unsigned long);
564564 }
565565 }
566566 }
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+5−0
@@ -1150,6 +1150,11 @@ static int stmmac_init_phy(struct net_device *dev) · 1149 unmodified lines
11501150 int addr = priv->plat->phy_addr;
11511151 struct phy_device *phydev;
11521152
1153+ if (addr < 0) {
1154+ netdev_err(priv->dev, "no phy found\n");
1155+ return -ENODEV;
1156+ }
1157+
11531158 phydev = mdiobus_get_phy(priv->mii, addr);
11541159 if (!phydev) {
11551160 netdev_err(priv->dev, "no phy at addr %d\n", addr);
drivers/net/ipa/ipa_interrupt.c+10−0
@@ -127,6 +127,16 @@ out_power_put: · 126 unmodified lines
127127 return IRQ_HANDLED;
128128 }
129129
130+void ipa_interrupt_irq_disable(struct ipa *ipa)
131+{
132+ disable_irq(ipa->interrupt->irq);
133+}
134+
135+void ipa_interrupt_irq_enable(struct ipa *ipa)
136+{
137+ enable_irq(ipa->interrupt->irq);
138+}
139+
130140 /* Common function used to enable/disable TX_SUSPEND for an endpoint */
131141 static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt,
132142 u32 endpoint_id, bool enable)
drivers/net/ipa/ipa_interrupt.h+16−0
@@ -85,6 +85,22 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt); · 84 unmodified lines
8585 */
8686 void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt);
8787
88+/**
89+ * ipa_interrupt_irq_enable() - Enable IPA interrupts
90+ * @ipa: IPA pointer
91+ *
92+ * This enables the IPA interrupt line
93+ */
94+void ipa_interrupt_irq_enable(struct ipa *ipa);
95+
96+/**
97+ * ipa_interrupt_irq_disable() - Disable IPA interrupts
98+ * @ipa: IPA pointer
99+ *
100+ * This disables the IPA interrupt line
101+ */
102+void ipa_interrupt_irq_disable(struct ipa *ipa);
103+
88104 /**
89105 * ipa_interrupt_config() - Configure the IPA interrupt framework
90106 * @ipa: IPA pointer
drivers/net/ipa/ipa_power.c+17−0
@@ -181,6 +181,17 @@ static int ipa_suspend(struct device *dev) · 180 unmodified lines
181181
182182 __set_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags);
183183
184+ /* Increment the disable depth to ensure that the IRQ won't
185+ * be re-enabled until the matching _enable call in
186+ * ipa_resume(). We do this to ensure that the interrupt
187+ * handler won't run whilst PM runtime is disabled.
188+ *
189+ * Note that disabling the IRQ is NOT the same as disabling
190+ * irq wake. If wakeup is enabled for the IPA then the IRQ
191+ * will still cause the system to wake up, see irq_set_irq_wake().
192+ */
193+ ipa_interrupt_irq_disable(ipa);
194+
184195 return pm_runtime_force_suspend(dev);
185196 }
186197
@@ -193,6 +204,12 @@ static int ipa_resume(struct device *dev) · 6 unmodified lines
193204
194205 __clear_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags);
195206
207+ /* Now that PM runtime is enabled again it's safe
208+ * to turn the IRQ back on and process any data
209+ * that was received during suspend.
210+ */
211+ ipa_interrupt_irq_enable(ipa);
212+
196213 return ret;
197214 }
198215
drivers/net/phy/mdio_bus.c+6−1
@@ -108,7 +108,12 @@ EXPORT_SYMBOL(mdiobus_unregister_device); · 107 unmodified lines
108108
109109 struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr)
110110 {
111− struct mdio_device *mdiodev = bus->mdio_map[addr];
111+ struct mdio_device *mdiodev;
112+
113+ if (addr < 0 || addr >= ARRAY_SIZE(bus->mdio_map))
114+ return NULL;
115+
116+ mdiodev = bus->mdio_map[addr];
112117
113118 if (!mdiodev)
114119 return NULL;
drivers/net/team/team.c+0−2
@@ -1044,7 +1044,6 @@ static int team_port_enter(struct team *team, struct team_port *port) · 1043 unmodified lines
10441044 goto err_port_enter;
10451045 }
10461046 }
1047− port->dev->priv_flags |= IFF_NO_ADDRCONF;
10481047
10491048 return 0;
10501049
@@ -1058,7 +1057,6 @@ static void team_port_leave(struct team *team, struct team_port *port) · 7 unmodified lines
10581057 {
10591058 if (team->ops.port_leave)
10601059 team->ops.port_leave(team, port);
1061− port->dev->priv_flags &= ~IFF_NO_ADDRCONF;
10621060 dev_put(team->dev);
10631061 }
10641062
drivers/net/usb/sr9700.c+1−1
@@ -413,7 +413,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 412 unmodified lines
413413 /* ignore the CRC length */
414414 len = (skb->data[1] | (skb->data[2] << 8)) - 4;
415415
416− if (len > ETH_FRAME_LEN || len > skb->len)
416+ if (len > ETH_FRAME_LEN || len > skb->len || len < 0)
417417 return 0;
418418
419419 /* the last packet of current skb */
drivers/net/virtio_net.c+4−2
@@ -1877,8 +1877,10 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) · 1876 unmodified lines
18771877 */
18781878 if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
18791879 netif_stop_subqueue(dev, qnum);
1880− if (!use_napi &&
1881− unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
1880+ if (use_napi) {
1881+ if (unlikely(!virtqueue_enable_cb_delayed(sq->vq)))
1882+ virtqueue_napi_schedule(&sq->napi, sq->vq);
1883+ } else if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
18821884 /* More just got used, free them then recheck. */
18831885 free_old_xmit_skbs(sq, false);
18841886 if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
drivers/net/wan/fsl_ucc_hdlc.c+4−2
@@ -1243,9 +1243,11 @@ static int ucc_hdlc_probe(struct platform_device *pdev) · 1242 unmodified lines
12431243 free_dev:
12441244 free_netdev(dev);
12451245 undo_uhdlc_init:
1246− iounmap(utdm->siram);
1246+ if (utdm)
1247+ iounmap(utdm->siram);
12471248 unmap_si_regs:
1248− iounmap(utdm->si_regs);
1249+ if (utdm)
1250+ iounmap(utdm->si_regs);
12491251 free_utdm:
12501252 if (uhdlc_priv->tsa)
12511253 kfree(utdm);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+19−18
@@ -7937,6 +7937,9 @@ cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev, · 7936 unmodified lines
79377937 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
79387938 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
79397939
7940+ if (chan->flags & IEEE80211_CHAN_DISABLED)
7941+ return -EINVAL;
7942+
79407943 /* set_channel */
79417944 chspec = channel_to_chanspec(&cfg->d11inf, chan);
79427945 if (chspec != INVCHANSPEC) {
@@ -7961,7 +7964,7 @@ brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, · 18 unmodified lines
79617964 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
79627965 struct brcmf_dump_survey survey = {};
79637966 struct ieee80211_supported_band *band;
7964− struct ieee80211_channel *chan;
7967+ enum nl80211_band band_id;
79657968 struct cca_msrmnt_query req;
79667969 u32 noise;
79677970 int err;
@@ -7974,26 +7977,25 @@ brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, · 6 unmodified lines
79747977 return -EBUSY;
79757978 }
79767979
7977− band = wiphy->bands[NL80211_BAND_2GHZ];
7978− if (band && idx >= band->n_channels) {
7979− idx -= band->n_channels;
7980− band = NULL;
7981− }
7980+ for (band_id = 0; band_id < NUM_NL80211_BANDS; band_id++) {
7981+ band = wiphy->bands[band_id];
7982+ if (!band)
7983+ continue;
7984+ if (idx >= band->n_channels) {
7985+ idx -= band->n_channels;
7986+ continue;
7987+ }
79827988
7983− if (!band || idx >= band->n_channels) {
7984− band = wiphy->bands[NL80211_BAND_5GHZ];
7985− if (idx >= band->n_channels)
7986− return -ENOENT;
7989+ info->channel = &band->channels[idx];
7990+ break;
79877991 }
7992+ if (band_id == NUM_NL80211_BANDS)
7993+ return -ENOENT;
79887994
79897995 /* Setting current channel to the requested channel */
7990− chan = &band->channels[idx];
7991− err = cfg80211_set_channel(wiphy, ndev, chan, NL80211_CHAN_HT20);
7992− if (err) {
7993− info->channel = chan;
7994− info->filled = 0;
7996+ info->filled = 0;
7997+ if (cfg80211_set_channel(wiphy, ndev, info->channel, NL80211_CHAN_HT20))
79957998 return 0;
7996− }
79977999
79988000 /* Disable mpc */
79998001 brcmf_set_mpc(ifp, 0);
@@ -8028,7 +8030,6 @@ brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, · 28 unmodified lines
80288030 if (err)
80298031 goto exit;
80308032
8031− info->channel = chan;
80328033 info->noise = noise;
80338034 info->time = ACS_MSRMNT_DELAY;
80348035 info->time_busy = ACS_MSRMNT_DELAY - survey.idle;
@@ -8040,7 +8041,7 @@ brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, · 5 unmodified lines
80408041 SURVEY_INFO_TIME_TX;
80418042
80428043 brcmf_dbg(INFO, "OBSS dump: channel %d: survey duration %d\n",
8043− ieee80211_frequency_to_channel(chan->center_freq),
8044+ ieee80211_frequency_to_channel(info->channel->center_freq),
80448045 ACS_MSRMNT_DELAY);
80458046 brcmf_dbg(INFO, "noise(%d) busy(%llu) rx(%llu) tx(%llu)\n",
80468047 info->noise, info->time_busy, info->time_rx, info->time_tx);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c+1−1
@@ -1228,7 +1228,7 @@ static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo) · 1227 unmodified lines
12281228 BRCMF_NROF_H2D_COMMON_MSGRINGS;
12291229 max_completionrings = BRCMF_NROF_D2H_COMMON_MSGRINGS;
12301230 }
1231− if (max_flowrings > 256) {
1231+ if (max_flowrings > 512) {
12321232 brcmf_err(bus, "invalid max_flowrings(%d)\n", max_flowrings);
12331233 return -EIO;
12341234 }
drivers/net/wireless/mediatek/mt76/dma.c+80−51
@@ -205,6 +205,52 @@ mt76_dma_queue_reset(struct mt76_dev *dev, struct mt76_queue *q) · 204 unmodified lines
205205 mt76_dma_sync_idx(dev, q);
206206 }
207207
208+static int
209+mt76_dma_add_rx_buf(struct mt76_dev *dev, struct mt76_queue *q,
210+ struct mt76_queue_buf *buf, void *data)
211+{
212+ struct mt76_desc *desc = &q->desc[q->head];
213+ struct mt76_queue_entry *entry = &q->entry[q->head];
214+ struct mt76_txwi_cache *txwi = NULL;
215+ u32 buf1 = 0, ctrl;
216+ int idx = q->head;
217+ int rx_token;
218+
219+ ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0, buf[0].len);
220+
221+ if ((q->flags & MT_QFLAG_WED) &&
222+ FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
223+ txwi = mt76_get_rxwi(dev);
224+ if (!txwi)
225+ return -ENOMEM;
226+
227+ rx_token = mt76_rx_token_consume(dev, data, txwi, buf->addr);
228+ if (rx_token < 0) {
229+ mt76_put_rxwi(dev, txwi);
230+ return -ENOMEM;
231+ }
232+
233+ buf1 |= FIELD_PREP(MT_DMA_CTL_TOKEN, rx_token);
234+ ctrl |= MT_DMA_CTL_TO_HOST;
235+ }
236+
237+ WRITE_ONCE(desc->buf0, cpu_to_le32(buf->addr));
238+ WRITE_ONCE(desc->buf1, cpu_to_le32(buf1));
239+ WRITE_ONCE(desc->ctrl, cpu_to_le32(ctrl));
240+ WRITE_ONCE(desc->info, 0);
241+
242+ entry->dma_addr[0] = buf->addr;
243+ entry->dma_len[0] = buf->len;
244+ entry->txwi = txwi;
245+ entry->buf = data;
246+ entry->wcid = 0xffff;
247+ entry->skip_buf1 = true;
248+ q->head = (q->head + 1) % q->ndesc;
249+ q->queued++;
250+
251+ return idx;
252+}
253+
208254 static int
209255 mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q,
210256 struct mt76_queue_buf *buf, int nbufs, u32 info,
@@ -212,65 +258,51 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q, · 1 unmodified line
212258 {
213259 struct mt76_queue_entry *entry;
214260 struct mt76_desc *desc;
215− u32 ctrl;
216261 int i, idx = -1;
262+ u32 ctrl, next;
263+
264+ if (txwi) {
265+ q->entry[q->head].txwi = DMA_DUMMY_DATA;
266+ q->entry[q->head].skip_buf0 = true;
267+ }
217268
218269 for (i = 0; i < nbufs; i += 2, buf += 2) {
219270 u32 buf0 = buf[0].addr, buf1 = 0;
220271
221272 idx = q->head;
222− q->head = (q->head + 1) % q->ndesc;
273+ next = (q->head + 1) % q->ndesc;
223274
224275 desc = &q->desc[idx];
225276 entry = &q->entry[idx];
226277
227− if ((q->flags & MT_QFLAG_WED) &&
228− FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
229− struct mt76_txwi_cache *t = txwi;
230− int rx_token;
231−
232− if (!t)
233− return -ENOMEM;
234−
235− rx_token = mt76_rx_token_consume(dev, (void *)skb, t,
236− buf[0].addr);
237− buf1 |= FIELD_PREP(MT_DMA_CTL_TOKEN, rx_token);
238− ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0, buf[0].len) |
239− MT_DMA_CTL_TO_HOST;
240− } else {
241− if (txwi) {
242− q->entry[q->head].txwi = DMA_DUMMY_DATA;
243− q->entry[q->head].skip_buf0 = true;
244− }
245−
246− if (buf[0].skip_unmap)
247− entry->skip_buf0 = true;
248− entry->skip_buf1 = i == nbufs - 1;
249−
250− entry->dma_addr[0] = buf[0].addr;
251− entry->dma_len[0] = buf[0].len;
252−
253− ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0, buf[0].len);
254− if (i < nbufs - 1) {
255− entry->dma_addr[1] = buf[1].addr;
256− entry->dma_len[1] = buf[1].len;
257− buf1 = buf[1].addr;
258− ctrl |= FIELD_PREP(MT_DMA_CTL_SD_LEN1, buf[1].len);
259− if (buf[1].skip_unmap)
260− entry->skip_buf1 = true;
261− }
262−
263− if (i == nbufs - 1)
264− ctrl |= MT_DMA_CTL_LAST_SEC0;
265− else if (i == nbufs - 2)
266− ctrl |= MT_DMA_CTL_LAST_SEC1;
278+ if (buf[0].skip_unmap)
279+ entry->skip_buf0 = true;
280+ entry->skip_buf1 = i == nbufs - 1;
281+
282+ entry->dma_addr[0] = buf[0].addr;
283+ entry->dma_len[0] = buf[0].len;
284+
285+ ctrl = FIELD_PREP(MT_DMA_CTL_SD_LEN0, buf[0].len);
286+ if (i < nbufs - 1) {
287+ entry->dma_addr[1] = buf[1].addr;
288+ entry->dma_len[1] = buf[1].len;
289+ buf1 = buf[1].addr;
290+ ctrl |= FIELD_PREP(MT_DMA_CTL_SD_LEN1, buf[1].len);
291+ if (buf[1].skip_unmap)
292+ entry->skip_buf1 = true;
267293 }
268294
295+ if (i == nbufs - 1)
296+ ctrl |= MT_DMA_CTL_LAST_SEC0;
297+ else if (i == nbufs - 2)
298+ ctrl |= MT_DMA_CTL_LAST_SEC1;
299+
269300 WRITE_ONCE(desc->buf0, cpu_to_le32(buf0));
270301 WRITE_ONCE(desc->buf1, cpu_to_le32(buf1));
271302 WRITE_ONCE(desc->info, cpu_to_le32(info));
272303 WRITE_ONCE(desc->ctrl, cpu_to_le32(ctrl));
273304
305+ q->head = next;
274306 q->queued++;
275307 }
276308
@@ -577,17 +609,9 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q) · 300 unmodified lines
577609 spin_lock_bh(&q->lock);
578610
579611 while (q->queued < q->ndesc - 1) {
580− struct mt76_txwi_cache *t = NULL;
581612 struct mt76_queue_buf qbuf;
582613 void *buf = NULL;
583614
584− if ((q->flags & MT_QFLAG_WED) &&
585− FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_RX) {
586− t = mt76_get_rxwi(dev);
587− if (!t)
588− break;
589− }
590−
591615 buf = page_frag_alloc(rx_page, q->buf_size, GFP_ATOMIC);
592616 if (!buf)
593617 break;
@@ -601,7 +625,12 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q) · 7 unmodified lines
601625 qbuf.addr = addr + offset;
602626 qbuf.len = len - offset;
603627 qbuf.skip_unmap = false;
604− mt76_dma_add_buf(dev, q, &qbuf, 1, 0, buf, t);
628+ if (mt76_dma_add_rx_buf(dev, q, &qbuf, buf) < 0) {
629+ dma_unmap_single(dev->dma_dev, addr, len,
630+ DMA_FROM_DEVICE);
631+ skb_free_frag(buf);
632+ break;
633+ }
605634 frames++;
606635 }
607636
drivers/net/wireless/mediatek/mt76/mt7915/mmio.c+7−0
@@ -653,6 +653,13 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size) · 652 unmodified lines
653653
654654 desc->buf0 = cpu_to_le32(phy_addr);
655655 token = mt76_rx_token_consume(&dev->mt76, ptr, t, phy_addr);
656+ if (token < 0) {
657+ dma_unmap_single(dev->mt76.dma_dev, phy_addr,
658+ wed->wlan.rx_size, DMA_TO_DEVICE);
659+ skb_free_frag(ptr);
660+ goto unmap;
661+ }
662+
656663 desc->token |= cpu_to_le32(FIELD_PREP(MT_DMA_CTL_TOKEN,
657664 token));
658665 desc++;
drivers/net/wireless/mediatek/mt76/tx.c+4−3
@@ -764,11 +764,12 @@ int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr, · 763 unmodified lines
764764 spin_lock_bh(&dev->rx_token_lock);
765765 token = idr_alloc(&dev->rx_token, t, 0, dev->rx_token_size,
766766 GFP_ATOMIC);
767+ if (token >= 0) {
768+ t->ptr = ptr;
769+ t->dma_addr = phys;
770+ }
767771 spin_unlock_bh(&dev->rx_token_lock);
768772
769− t->ptr = ptr;
770− t->dma_addr = phys;
771−
772773 return token;
773774 }
774775 EXPORT_SYMBOL_GPL(mt76_rx_token_consume);
drivers/net/wireless/rndis_wlan.c+6−13
@@ -696,8 +696,8 @@ static int rndis_query_oid(struct usbnet *dev, u32 oid, void *data, int *len) · 695 unmodified lines
696696 struct rndis_query *get;
697697 struct rndis_query_c *get_c;
698698 } u;
699− int ret, buflen;
700− int resplen, respoffs, copylen;
699+ int ret;
700+ size_t buflen, resplen, respoffs, copylen;
701701
702702 buflen = *len + sizeof(*u.get);
703703 if (buflen < CONTROL_BUFFER_SIZE)
@@ -732,22 +732,15 @@ static int rndis_query_oid(struct usbnet *dev, u32 oid, void *data, int *len) · 28 unmodified lines
732732
733733 if (respoffs > buflen) {
734734 /* Device returned data offset outside buffer, error. */
735− netdev_dbg(dev->net, "%s(%s): received invalid "
736− "data offset: %d > %d\n", __func__,
737− oid_to_string(oid), respoffs, buflen);
735+ netdev_dbg(dev->net,
736+ "%s(%s): received invalid data offset: %zu > %zu\n",
737+ __func__, oid_to_string(oid), respoffs, buflen);
738738
739739 ret = -EINVAL;
740740 goto exit_unlock;
741741 }
742742
743− if ((resplen + respoffs) > buflen) {
744− /* Device would have returned more data if buffer would
745− * have been big enough. Copy just the bits that we got.
746− */
747− copylen = buflen - respoffs;
748− } else {
749− copylen = resplen;
750− }
743+ copylen = min(resplen, buflen - respoffs);
751744
752745 if (copylen > *len)
753746 copylen = *len;
include/linux/bpf.h+1−1
@@ -1832,7 +1832,7 @@ void bpf_prog_inc(struct bpf_prog *prog); · 1831 unmodified lines
18321832 struct bpf_prog * __must_check bpf_prog_inc_not_zero(struct bpf_prog *prog);
18331833 void bpf_prog_put(struct bpf_prog *prog);
18341834
1835−void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock);
1835+void bpf_prog_free_id(struct bpf_prog *prog);
18361836 void bpf_map_free_id(struct bpf_map *map, bool do_idr_lock);
18371837
18381838 struct btf_field *btf_record_find(const struct btf_record *rec,
include/net/mac80211.h+0−4
@@ -1832,8 +1832,6 @@ struct ieee80211_vif_cfg { · 1831 unmodified lines
18321832 * @drv_priv: data area for driver use, will always be aligned to
18331833 * sizeof(void \*).
18341834 * @txq: the multicast data TX queue
1835− * @txqs_stopped: per AC flag to indicate that intermediate TXQs are stopped,
1836− * protected by fq->lock.
18371835 * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see
18381836 * &enum ieee80211_offload_flags.
18391837 * @mbssid_tx_vif: Pointer to the transmitting interface if MBSSID is enabled.
@@ -1863,8 +1861,6 @@ struct ieee80211_vif { · 23 unmodified lines
18631861 bool probe_req_reg;
18641862 bool rx_mcast_action_reg;
18651863
1866− bool txqs_stopped[IEEE80211_NUM_ACS];
1867−
18681864 struct ieee80211_vif *mbssid_tx_vif;
18691865
18701866 /* must be last */
include/net/sch_generic.h+7−0
@@ -1288,4 +1288,11 @@ void mq_change_real_num_tx(struct Qdisc *sch, unsigned int new_real_tx); · 1287 unmodified lines
12881288
12891289 int sch_frag_xmit_hook(struct sk_buff *skb, int (*xmit)(struct sk_buff *skb));
12901290
1291+/* Make sure qdisc is no longer in SCHED state. */
1292+static inline void qdisc_synchronize(const struct Qdisc *q)
1293+{
1294+ while (test_bit(__QDISC_STATE_SCHED, &q->state))
1295+ msleep(1);
1296+}
1297+
12911298 #endif
kernel/bpf/hashtab.c+2−2
@@ -152,7 +152,7 @@ static inline int htab_lock_bucket(const struct bpf_htab *htab, · 151 unmodified lines
152152 {
153153 unsigned long flags;
154154
155− hash = hash & HASHTAB_MAP_LOCK_MASK;
155+ hash = hash & min_t(u32, HASHTAB_MAP_LOCK_MASK, htab->n_buckets - 1);
156156
157157 preempt_disable();
158158 if (unlikely(__this_cpu_inc_return(*(htab->map_locked[hash])) != 1)) {
@@ -171,7 +171,7 @@ static inline void htab_unlock_bucket(const struct bpf_htab *htab, · 12 unmodified lines
171171 struct bucket *b, u32 hash,
172172 unsigned long flags)
173173 {
174− hash = hash & HASHTAB_MAP_LOCK_MASK;
174+ hash = hash & min_t(u32, HASHTAB_MAP_LOCK_MASK, htab->n_buckets - 1);
175175 raw_spin_unlock_irqrestore(&b->raw_lock, flags);
176176 __this_cpu_dec(*(htab->map_locked[hash]));
177177 preempt_enable();
kernel/bpf/offload.c+0−3
@@ -216,9 +216,6 @@ static void __bpf_prog_offload_destroy(struct bpf_prog *prog) · 215 unmodified lines
216216 if (offload->dev_state)
217217 offload->offdev->ops->destroy(prog);
218218
219− /* Make sure BPF_PROG_GET_NEXT_ID can't find this dead program */
220− bpf_prog_free_id(prog, true);
221−
222219 list_del_init(&offload->offloads);
223220 kfree(offload);
224221 prog->aux->offload = NULL;
kernel/bpf/syscall.c+7−17
@@ -1972,7 +1972,7 @@ static void bpf_audit_prog(const struct bpf_prog *prog, unsigned int op) · 1971 unmodified lines
19721972 return;
19731973 if (audit_enabled == AUDIT_OFF)
19741974 return;
1975− if (op == BPF_AUDIT_LOAD)
1975+ if (!in_irq() && !irqs_disabled())
19761976 ctx = audit_context();
19771977 ab = audit_log_start(ctx, GFP_ATOMIC, AUDIT_BPF);
19781978 if (unlikely(!ab))
@@ -2001,7 +2001,7 @@ static int bpf_prog_alloc_id(struct bpf_prog *prog) · 22 unmodified lines
20012001 return id > 0 ? 0 : id;
20022002 }
20032003
2004−void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock)
2004+void bpf_prog_free_id(struct bpf_prog *prog)
20052005 {
20062006 unsigned long flags;
20072007
@@ -2013,18 +2013,10 @@ void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock) · 5 unmodified lines
20132013 if (!prog->aux->id)
20142014 return;
20152015
2016− if (do_idr_lock)
2017− spin_lock_irqsave(&prog_idr_lock, flags);
2018− else
2019− __acquire(&prog_idr_lock);
2020−
2016+ spin_lock_irqsave(&prog_idr_lock, flags);
20212017 idr_remove(&prog_idr, prog->aux->id);
20222018 prog->aux->id = 0;
2023−
2024− if (do_idr_lock)
2025− spin_unlock_irqrestore(&prog_idr_lock, flags);
2026− else
2027− __release(&prog_idr_lock);
2019+ spin_unlock_irqrestore(&prog_idr_lock, flags);
20282020 }
20292021
20302022 static void __bpf_prog_put_rcu(struct rcu_head *rcu)
@@ -2067,17 +2059,15 @@ static void bpf_prog_put_deferred(struct work_struct *work) · 36 unmodified lines
20672059 prog = aux->prog;
20682060 perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_UNLOAD, 0);
20692061 bpf_audit_prog(prog, BPF_AUDIT_UNLOAD);
2062+ bpf_prog_free_id(prog);
20702063 __bpf_prog_put_noref(prog, true);
20712064 }
20722065
2073−static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock)
2066+static void __bpf_prog_put(struct bpf_prog *prog)
20742067 {
20752068 struct bpf_prog_aux *aux = prog->aux;
20762069
20772070 if (atomic64_dec_and_test(&aux->refcnt)) {
2078− /* bpf_prog_free_id() must be called first */
2079− bpf_prog_free_id(prog, do_idr_lock);
2080−
20812071 if (in_irq() || irqs_disabled()) {
20822072 INIT_WORK(&aux->work, bpf_prog_put_deferred);
20832073 schedule_work(&aux->work);
@@ -2089,7 +2079,7 @@ static void __bpf_prog_put(struct bpf_prog *prog, bool do_idr_lock) · 5 unmodified lines
20892079
20902080 void bpf_prog_put(struct bpf_prog *prog)
20912081 {
2092− __bpf_prog_put(prog, true);
2082+ __bpf_prog_put(prog);
20932083 }
20942084 EXPORT_SYMBOL_GPL(bpf_prog_put);
20952085
kernel/bpf/verifier.c+9−1
@@ -2748,6 +2748,12 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx, · 2747 unmodified lines
27482748 */
27492749 if (insn->src_reg == 0 && is_callback_calling_function(insn->imm))
27502750 return -ENOTSUPP;
2751+ /* kfunc with imm==0 is invalid and fixup_kfunc_call will
2752+ * catch this error later. Make backtracking conservative
2753+ * with ENOTSUPP.
2754+ */
2755+ if (insn->src_reg == BPF_PSEUDO_KFUNC_CALL && insn->imm == 0)
2756+ return -ENOTSUPP;
27512757 /* regular helper call sets R0 */
27522758 *reg_mask &= ~1;
27532759 if (*reg_mask & 0x3f) {
@@ -3289,7 +3295,9 @@ static int check_stack_write_fixed_off(struct bpf_verifier_env *env, · 535 unmodified lines
32893295 bool sanitize = reg && is_spillable_regtype(reg->type);
32903296
32913297 for (i = 0; i < size; i++) {
3292− if (state->stack[spi].slot_type[i] == STACK_INVALID) {
3298+ u8 type = state->stack[spi].slot_type[i];
3299+
3300+ if (type != STACK_MISC && type != STACK_ZERO) {
32933301 sanitize = true;
32943302 break;
32953303 }
kernel/trace/bpf_trace.c+3−0
@@ -848,6 +848,9 @@ static int bpf_send_signal_common(u32 sig, enum pid_type type) · 847 unmodified lines
848848 return -EPERM;
849849 if (unlikely(!nmi_uaccess_okay()))
850850 return -EPERM;
851+ /* Task should not be pid=1 to avoid kernel panic. */
852+ if (unlikely(is_global_init(current)))
853+ return -EPERM;
851854
852855 if (irqs_disabled()) {
853856 /* Do an early check on signal validity. Otherwise,
net/bluetooth/hci_conn.c+14−4
@@ -821,6 +821,7 @@ static void terminate_big_destroy(struct hci_dev *hdev, void *data, int err) · 820 unmodified lines
821821 static int hci_le_terminate_big(struct hci_dev *hdev, u8 big, u8 bis)
822822 {
823823 struct iso_list_data *d;
824+ int ret;
824825
825826 bt_dev_dbg(hdev, "big 0x%2.2x bis 0x%2.2x", big, bis);
826827
@@ -831,8 +832,12 @@ static int hci_le_terminate_big(struct hci_dev *hdev, u8 big, u8 bis) · 4 unmodified lines
831832 d->big = big;
832833 d->bis = bis;
833834
834− return hci_cmd_sync_queue(hdev, terminate_big_sync, d,
835− terminate_big_destroy);
835+ ret = hci_cmd_sync_queue(hdev, terminate_big_sync, d,
836+ terminate_big_destroy);
837+ if (ret)
838+ kfree(d);
839+
840+ return ret;
836841 }
837842
838843 static int big_terminate_sync(struct hci_dev *hdev, void *data)
@@ -857,6 +862,7 @@ static int big_terminate_sync(struct hci_dev *hdev, void *data) · 18 unmodified lines
857862 static int hci_le_big_terminate(struct hci_dev *hdev, u8 big, u16 sync_handle)
858863 {
859864 struct iso_list_data *d;
865+ int ret;
860866
861867 bt_dev_dbg(hdev, "big 0x%2.2x sync_handle 0x%4.4x", big, sync_handle);
862868
@@ -867,8 +873,12 @@ static int hci_le_big_terminate(struct hci_dev *hdev, u8 big, u16 sync_handle) · 4 unmodified lines
867873 d->big = big;
868874 d->sync_handle = sync_handle;
869875
870− return hci_cmd_sync_queue(hdev, big_terminate_sync, d,
871− terminate_big_destroy);
876+ ret = hci_cmd_sync_queue(hdev, big_terminate_sync, d,
877+ terminate_big_destroy);
878+ if (ret)
879+ kfree(d);
880+
881+ return ret;
872882 }
873883
874884 /* Cleanup BIS connection
net/bluetooth/hci_event.c+4−1
@@ -3848,8 +3848,11 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data, · 3847 unmodified lines
38483848 conn->handle, conn->link);
38493849
38503850 /* Create CIS if LE is already connected */
3851− if (conn->link && conn->link->state == BT_CONNECTED)
3851+ if (conn->link && conn->link->state == BT_CONNECTED) {
3852+ rcu_read_unlock();
38523853 hci_le_create_cis(conn->link);
3854+ rcu_read_lock();
3855+ }
38533856
38543857 if (i == rp->num_handles)
38553858 break;
net/bluetooth/hci_sync.c+6−13
@@ -3572,7 +3572,7 @@ static const struct hci_init_stage hci_init2[] = { · 3571 unmodified lines
35723572 static int hci_le_read_buffer_size_sync(struct hci_dev *hdev)
35733573 {
35743574 /* Use Read LE Buffer Size V2 if supported */
3575− if (hdev->commands[41] & 0x20)
3575+ if (iso_capable(hdev) && hdev->commands[41] & 0x20)
35763576 return __hci_cmd_sync_status(hdev,
35773577 HCI_OP_LE_READ_BUFFER_SIZE_V2,
35783578 0, NULL, HCI_CMD_TIMEOUT);
@@ -3597,10 +3597,10 @@ static int hci_le_read_supported_states_sync(struct hci_dev *hdev) · 18 unmodified lines
35973597
35983598 /* LE Controller init stage 2 command sequence */
35993599 static const struct hci_init_stage le_init2[] = {
3600− /* HCI_OP_LE_READ_BUFFER_SIZE */
3601− HCI_INIT(hci_le_read_buffer_size_sync),
36023600 /* HCI_OP_LE_READ_LOCAL_FEATURES */
36033601 HCI_INIT(hci_le_read_local_features_sync),
3602+ /* HCI_OP_LE_READ_BUFFER_SIZE */
3603+ HCI_INIT(hci_le_read_buffer_size_sync),
36043604 /* HCI_OP_LE_READ_SUPPORTED_STATES */
36053605 HCI_INIT(hci_le_read_supported_states_sync),
36063606 {}
@@ -6187,20 +6187,13 @@ int hci_get_random_address(struct hci_dev *hdev, bool require_privacy, · 2580 unmodified lines
61876187
61886188 static int _update_adv_data_sync(struct hci_dev *hdev, void *data)
61896189 {
6190− u8 instance = *(u8 *)data;
6191−
6192− kfree(data);
6190+ u8 instance = PTR_ERR(data);
61936191
61946192 return hci_update_adv_data_sync(hdev, instance);
61956193 }
61966194
61976195 int hci_update_adv_data(struct hci_dev *hdev, u8 instance)
61986196 {
6199− u8 *inst_ptr = kmalloc(1, GFP_KERNEL);
6200−
6201− if (!inst_ptr)
6202− return -ENOMEM;
6203−
6204− *inst_ptr = instance;
6205− return hci_cmd_sync_queue(hdev, _update_adv_data_sync, inst_ptr, NULL);
6197+ return hci_cmd_sync_queue(hdev, _update_adv_data_sync,
6198+ ERR_PTR(instance), NULL);
62066199 }
net/bluetooth/iso.c+26−38
@@ -289,15 +289,15 @@ static int iso_connect_bis(struct sock *sk) · 288 unmodified lines
289289 hci_dev_unlock(hdev);
290290 hci_dev_put(hdev);
291291
292+ err = iso_chan_add(conn, sk, NULL);
293+ if (err)
294+ return err;
295+
292296 lock_sock(sk);
293297
294298 /* Update source addr of the socket */
295299 bacpy(&iso_pi(sk)->src, &hcon->src);
296300
297− err = iso_chan_add(conn, sk, NULL);
298− if (err)
299− goto release;
300−
301301 if (hcon->state == BT_CONNECTED) {
302302 iso_sock_clear_timer(sk);
303303 sk->sk_state = BT_CONNECTED;
@@ -306,7 +306,6 @@ static int iso_connect_bis(struct sock *sk) · 2 unmodified lines
306306 iso_sock_set_timer(sk, sk->sk_sndtimeo);
307307 }
308308
309−release:
310309 release_sock(sk);
311310 return err;
312311
@@ -372,15 +371,15 @@ static int iso_connect_cis(struct sock *sk) · 59 unmodified lines
372371 hci_dev_unlock(hdev);
373372 hci_dev_put(hdev);
374373
374+ err = iso_chan_add(conn, sk, NULL);
375+ if (err)
376+ return err;
377+
375378 lock_sock(sk);
376379
377380 /* Update source addr of the socket */
378381 bacpy(&iso_pi(sk)->src, &hcon->src);
379382
380− err = iso_chan_add(conn, sk, NULL);
381− if (err)
382− goto release;
383−
384383 if (hcon->state == BT_CONNECTED) {
385384 iso_sock_clear_timer(sk);
386385 sk->sk_state = BT_CONNECTED;
@@ -392,7 +391,6 @@ static int iso_connect_cis(struct sock *sk) · 5 unmodified lines
392391 iso_sock_set_timer(sk, sk->sk_sndtimeo);
393392 }
394393
395−release:
396394 release_sock(sk);
397395 return err;
398396
@@ -895,13 +893,10 @@ static int iso_listen_bis(struct sock *sk) · 496 unmodified lines
895893 if (!hdev)
896894 return -EHOSTUNREACH;
897895
898− hci_dev_lock(hdev);
899−
900896 err = hci_pa_create_sync(hdev, &iso_pi(sk)->dst,
901897 le_addr_type(iso_pi(sk)->dst_type),
902898 iso_pi(sk)->bc_sid);
903899
904− hci_dev_unlock(hdev);
905900 hci_dev_put(hdev);
906901
907902 return err;
@@ -1432,33 +1427,29 @@ static void iso_conn_ready(struct iso_conn *conn) · 524 unmodified lines
14321427 struct sock *parent;
14331428 struct sock *sk = conn->sk;
14341429 struct hci_ev_le_big_sync_estabilished *ev;
1430+ struct hci_conn *hcon;
14351431
14361432 BT_DBG("conn %p", conn);
14371433
14381434 if (sk) {
14391435 iso_sock_ready(conn->sk);
14401436 } else {
1441− iso_conn_lock(conn);
1442−
1443− if (!conn->hcon) {
1444− iso_conn_unlock(conn);
1437+ hcon = conn->hcon;
1438+ if (!hcon)
14451439 return;
1446− }
14471440
1448− ev = hci_recv_event_data(conn->hcon->hdev,
1441+ ev = hci_recv_event_data(hcon->hdev,
14491442 HCI_EVT_LE_BIG_SYNC_ESTABILISHED);
14501443 if (ev)
1451− parent = iso_get_sock_listen(&conn->hcon->src,
1452− &conn->hcon->dst,
1444+ parent = iso_get_sock_listen(&hcon->src,
1445+ &hcon->dst,
14531446 iso_match_big, ev);
14541447 else
1455− parent = iso_get_sock_listen(&conn->hcon->src,
1448+ parent = iso_get_sock_listen(&hcon->src,
14561449 BDADDR_ANY, NULL, NULL);
14571450
1458− if (!parent) {
1459− iso_conn_unlock(conn);
1451+ if (!parent)
14601452 return;
1461− }
14621453
14631454 lock_sock(parent);
14641455
@@ -1466,30 +1457,29 @@ static void iso_conn_ready(struct iso_conn *conn) · 1 unmodified line
14661457 BTPROTO_ISO, GFP_ATOMIC, 0);
14671458 if (!sk) {
14681459 release_sock(parent);
1469− iso_conn_unlock(conn);
14701460 return;
14711461 }
14721462
14731463 iso_sock_init(sk, parent);
14741464
1475− bacpy(&iso_pi(sk)->src, &conn->hcon->src);
1476− iso_pi(sk)->src_type = conn->hcon->src_type;
1465+ bacpy(&iso_pi(sk)->src, &hcon->src);
1466+ iso_pi(sk)->src_type = hcon->src_type;
14771467
14781468 /* If hcon has no destination address (BDADDR_ANY) it means it
14791469 * was created by HCI_EV_LE_BIG_SYNC_ESTABILISHED so we need to
14801470 * initialize using the parent socket destination address.
14811471 */
1482− if (!bacmp(&conn->hcon->dst, BDADDR_ANY)) {
1483− bacpy(&conn->hcon->dst, &iso_pi(parent)->dst);
1484− conn->hcon->dst_type = iso_pi(parent)->dst_type;
1485− conn->hcon->sync_handle = iso_pi(parent)->sync_handle;
1472+ if (!bacmp(&hcon->dst, BDADDR_ANY)) {
1473+ bacpy(&hcon->dst, &iso_pi(parent)->dst);
1474+ hcon->dst_type = iso_pi(parent)->dst_type;
1475+ hcon->sync_handle = iso_pi(parent)->sync_handle;
14861476 }
14871477
1488− bacpy(&iso_pi(sk)->dst, &conn->hcon->dst);
1489− iso_pi(sk)->dst_type = conn->hcon->dst_type;
1478+ bacpy(&iso_pi(sk)->dst, &hcon->dst);
1479+ iso_pi(sk)->dst_type = hcon->dst_type;
14901480
1491− hci_conn_hold(conn->hcon);
1492− __iso_chan_add(conn, sk, parent);
1481+ hci_conn_hold(hcon);
1482+ iso_chan_add(conn, sk, parent);
14931483
14941484 if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags))
14951485 sk->sk_state = BT_CONNECT2;
@@ -1500,8 +1490,6 @@ static void iso_conn_ready(struct iso_conn *conn) · 4 unmodified lines
15001490 parent->sk_data_ready(parent);
15011491
15021492 release_sock(parent);
1503−
1504− iso_conn_unlock(conn);
15051493 }
15061494 }
15071495
net/bluetooth/mgmt_util.h+1−1
@@ -27,7 +27,7 @@ struct mgmt_mesh_tx { · 26 unmodified lines
2727 struct sock *sk;
2828 u8 handle;
2929 u8 instance;
30− u8 param[sizeof(struct mgmt_cp_mesh_send) + 29];
30+ u8 param[sizeof(struct mgmt_cp_mesh_send) + 31];
3131 };
3232
3333 struct mgmt_pending_cmd {
net/bluetooth/rfcomm/sock.c+6−1
@@ -391,6 +391,7 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a · 390 unmodified lines
391391 addr->sa_family != AF_BLUETOOTH)
392392 return -EINVAL;
393393
394+ sock_hold(sk);
394395 lock_sock(sk);
395396
396397 if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND) {
@@ -410,14 +411,18 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a · 13 unmodified lines
410411 d->sec_level = rfcomm_pi(sk)->sec_level;
411412 d->role_switch = rfcomm_pi(sk)->role_switch;
412413
414+ /* Drop sock lock to avoid potential deadlock with the RFCOMM lock */
415+ release_sock(sk);
413416 err = rfcomm_dlc_open(d, &rfcomm_pi(sk)->src, &sa->rc_bdaddr,
414417 sa->rc_channel);
415− if (!err)
418+ lock_sock(sk);
419+ if (!err && !sock_flag(sk, SOCK_ZAPPED))
416420 err = bt_sock_wait_state(sk, BT_CONNECTED,
417421 sock_sndtimeo(sk, flags & O_NONBLOCK));
418422
419423 done:
420424 release_sock(sk);
425+ sock_put(sk);
421426 return err;
422427 }
423428
net/ethtool/rss.c+7−4
@@ -122,10 +122,13 @@ rss_fill_reply(struct sk_buff *skb, const struct ethnl_req_info *req_base, · 121 unmodified lines
122122 {
123123 const struct rss_reply_data *data = RSS_REPDATA(reply_base);
124124
125− if (nla_put_u32(skb, ETHTOOL_A_RSS_HFUNC, data->hfunc) ||
126− nla_put(skb, ETHTOOL_A_RSS_INDIR,
127− sizeof(u32) * data->indir_size, data->indir_table) ||
128− nla_put(skb, ETHTOOL_A_RSS_HKEY, data->hkey_size, data->hkey))
125+ if ((data->hfunc &&
126+ nla_put_u32(skb, ETHTOOL_A_RSS_HFUNC, data->hfunc)) ||
127+ (data->indir_size &&
128+ nla_put(skb, ETHTOOL_A_RSS_INDIR,
129+ sizeof(u32) * data->indir_size, data->indir_table)) ||
130+ (data->hkey_size &&
131+ nla_put(skb, ETHTOOL_A_RSS_HKEY, data->hkey_size, data->hkey)))
129132 return -EMSGSIZE;
130133
131134 return 0;
net/ipv4/inet_hashtables.c+15−2
@@ -650,8 +650,20 @@ bool inet_ehash_insert(struct sock *sk, struct sock *osk, bool *found_dup_sk) · 649 unmodified lines
650650 spin_lock(lock);
651651 if (osk) {
652652 WARN_ON_ONCE(sk->sk_hash != osk->sk_hash);
653− ret = sk_nulls_del_node_init_rcu(osk);
654− } else if (found_dup_sk) {
653+ ret = sk_hashed(osk);
654+ if (ret) {
655+ /* Before deleting the node, we insert a new one to make
656+ * sure that the look-up-sk process would not miss either
657+ * of them and that at least one node would exist in ehash
658+ * table all the time. Otherwise there's a tiny chance
659+ * that lookup process could find nothing in ehash table.
660+ */
661+ __sk_nulls_add_node_tail_rcu(sk, list);
662+ sk_nulls_del_node_init_rcu(osk);
663+ }
664+ goto unlock;
665+ }
666+ if (found_dup_sk) {
655667 *found_dup_sk = inet_ehash_lookup_by_sk(sk, list);
656668 if (*found_dup_sk)
657669 ret = false;
@@ -660,6 +672,7 @@ bool inet_ehash_insert(struct sock *sk, struct sock *osk, bool *found_dup_sk) · 2 unmodified lines
660672 if (ret)
661673 __sk_nulls_add_node_rcu(sk, list);
662674
675+unlock:
663676 spin_unlock(lock);
664677
665678 return ret;
net/ipv4/inet_timewait_sock.c+4−4
@@ -91,10 +91,10 @@ void inet_twsk_put(struct inet_timewait_sock *tw) · 90 unmodified lines
9191 }
9292 EXPORT_SYMBOL_GPL(inet_twsk_put);
9393
94−static void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,
95− struct hlist_nulls_head *list)
94+static void inet_twsk_add_node_tail_rcu(struct inet_timewait_sock *tw,
95+ struct hlist_nulls_head *list)
9696 {
97− hlist_nulls_add_head_rcu(&tw->tw_node, list);
97+ hlist_nulls_add_tail_rcu(&tw->tw_node, list);
9898 }
9999
100100 static void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
@@ -147,7 +147,7 @@ void inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, · 46 unmodified lines
147147
148148 spin_lock(lock);
149149
150− inet_twsk_add_node_rcu(tw, &ehead->chain);
150+ inet_twsk_add_node_tail_rcu(tw, &ehead->chain);
151151
152152 /* Step 3: Remove SK from hash chain */
153153 if (__sk_nulls_del_node_init_rcu(sk))
net/ipv4/tcp.c+2−0
@@ -435,6 +435,7 @@ void tcp_init_sock(struct sock *sk) · 434 unmodified lines
435435
436436 /* There's a bubble in the pipe until at least the first ACK. */
437437 tp->app_limited = ~0U;
438+ tp->rate_app_limited = 1;
438439
439440 /* See draft-stevens-tcpca-spec-01 for discussion of the
440441 * initialization of these values.
@@ -3178,6 +3179,7 @@ int tcp_disconnect(struct sock *sk, int flags) · 2737 unmodified lines
31783179 tp->plb_rehash = 0;
31793180 /* There's a bubble in the pipe until at least the first ACK. */
31803181 tp->app_limited = ~0U;
3182+ tp->rate_app_limited = 1;
31813183 tp->rack.mstamp = 0;
31823184 tp->rack.advanced = 0;
31833185 tp->rack.reo_wnd_steps = 1;
net/ipv4/tcp_ulp.c+1−1
@@ -139,7 +139,7 @@ static int __tcp_set_ulp(struct sock *sk, const struct tcp_ulp_ops *ulp_ops) · 138 unmodified lines
139139 if (sk->sk_socket)
140140 clear_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags);
141141
142− err = -EINVAL;
142+ err = -ENOTCONN;
143143 if (!ulp_ops->clone && sk->sk_state == TCP_LISTEN)
144144 goto out_err;
145145
net/l2tp/l2tp_core.c+50−52
@@ -104,9 +104,9 @@ static struct workqueue_struct *l2tp_wq; · 103 unmodified lines
104104 /* per-net private data for this module */
105105 static unsigned int l2tp_net_id;
106106 struct l2tp_net {
107− struct list_head l2tp_tunnel_list;
108− /* Lock for write access to l2tp_tunnel_list */
109− spinlock_t l2tp_tunnel_list_lock;
107+ /* Lock for write access to l2tp_tunnel_idr */
108+ spinlock_t l2tp_tunnel_idr_lock;
109+ struct idr l2tp_tunnel_idr;
110110 struct hlist_head l2tp_session_hlist[L2TP_HASH_SIZE_2];
111111 /* Lock for write access to l2tp_session_hlist */
112112 spinlock_t l2tp_session_hlist_lock;
@@ -208,13 +208,10 @@ struct l2tp_tunnel *l2tp_tunnel_get(const struct net *net, u32 tunnel_id) · 95 unmodified lines
208208 struct l2tp_tunnel *tunnel;
209209
210210 rcu_read_lock_bh();
211− list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
212− if (tunnel->tunnel_id == tunnel_id &&
213− refcount_inc_not_zero(&tunnel->ref_count)) {
214− rcu_read_unlock_bh();
215−
216− return tunnel;
217− }
211+ tunnel = idr_find(&pn->l2tp_tunnel_idr, tunnel_id);
212+ if (tunnel && refcount_inc_not_zero(&tunnel->ref_count)) {
213+ rcu_read_unlock_bh();
214+ return tunnel;
218215 }
219216 rcu_read_unlock_bh();
220217
@@ -224,13 +221,14 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_get); · 3 unmodified lines
224221
225222 struct l2tp_tunnel *l2tp_tunnel_get_nth(const struct net *net, int nth)
226223 {
227− const struct l2tp_net *pn = l2tp_pernet(net);
224+ struct l2tp_net *pn = l2tp_pernet(net);
225+ unsigned long tunnel_id, tmp;
228226 struct l2tp_tunnel *tunnel;
229227 int count = 0;
230228
231229 rcu_read_lock_bh();
232− list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
233− if (++count > nth &&
230+ idr_for_each_entry_ul(&pn->l2tp_tunnel_idr, tunnel, tmp, tunnel_id) {
231+ if (tunnel && ++count > nth &&
234232 refcount_inc_not_zero(&tunnel->ref_count)) {
235233 rcu_read_unlock_bh();
236234 return tunnel;
@@ -1043,7 +1041,7 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, uns · 806 unmodified lines
10431041 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | IPSKB_REROUTED);
10441042 nf_reset_ct(skb);
10451043
1046− bh_lock_sock(sk);
1044+ bh_lock_sock_nested(sk);
10471045 if (sock_owned_by_user(sk)) {
10481046 kfree_skb(skb);
10491047 ret = NET_XMIT_DROP;
@@ -1227,6 +1225,15 @@ static void l2tp_udp_encap_destroy(struct sock *sk) · 177 unmodified lines
12271225 l2tp_tunnel_delete(tunnel);
12281226 }
12291227
1228+static void l2tp_tunnel_remove(struct net *net, struct l2tp_tunnel *tunnel)
1229+{
1230+ struct l2tp_net *pn = l2tp_pernet(net);
1231+
1232+ spin_lock_bh(&pn->l2tp_tunnel_idr_lock);
1233+ idr_remove(&pn->l2tp_tunnel_idr, tunnel->tunnel_id);
1234+ spin_unlock_bh(&pn->l2tp_tunnel_idr_lock);
1235+}
1236+
12301237 /* Workqueue tunnel deletion function */
12311238 static void l2tp_tunnel_del_work(struct work_struct *work)
12321239 {
@@ -1234,7 +1241,6 @@ static void l2tp_tunnel_del_work(struct work_struct *work) · 1 unmodified line
12341241 del_work);
12351242 struct sock *sk = tunnel->sock;
12361243 struct socket *sock = sk->sk_socket;
1237− struct l2tp_net *pn;
12381244
12391245 l2tp_tunnel_closeall(tunnel);
12401246
@@ -1248,12 +1254,7 @@ static void l2tp_tunnel_del_work(struct work_struct *work) · 7 unmodified lines
12481254 }
12491255 }
12501256
1251− /* Remove the tunnel struct from the tunnel list */
1252− pn = l2tp_pernet(tunnel->l2tp_net);
1253− spin_lock_bh(&pn->l2tp_tunnel_list_lock);
1254− list_del_rcu(&tunnel->list);
1255− spin_unlock_bh(&pn->l2tp_tunnel_list_lock);
1256−
1257+ l2tp_tunnel_remove(tunnel->l2tp_net, tunnel);
12571258 /* drop initial ref */
12581259 l2tp_tunnel_dec_refcount(tunnel);
12591260
@@ -1384,8 +1385,6 @@ out: · 124 unmodified lines
13841385 return err;
13851386 }
13861387
1387−static struct lock_class_key l2tp_socket_class;
1388−
13891388 int l2tp_tunnel_create(int fd, int version, u32 tunnel_id, u32 peer_tunnel_id,
13901389 struct l2tp_tunnel_cfg *cfg, struct l2tp_tunnel **tunnelp)
13911390 {
@@ -1455,12 +1454,19 @@ static int l2tp_validate_socket(const struct sock *sk, const struct net *net, · 63 unmodified lines
14551454 int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net,
14561455 struct l2tp_tunnel_cfg *cfg)
14571456 {
1458− struct l2tp_tunnel *tunnel_walk;
1459− struct l2tp_net *pn;
1457+ struct l2tp_net *pn = l2tp_pernet(net);
1458+ u32 tunnel_id = tunnel->tunnel_id;
14601459 struct socket *sock;
14611460 struct sock *sk;
14621461 int ret;
14631462
1463+ spin_lock_bh(&pn->l2tp_tunnel_idr_lock);
1464+ ret = idr_alloc_u32(&pn->l2tp_tunnel_idr, NULL, &tunnel_id, tunnel_id,
1465+ GFP_ATOMIC);
1466+ spin_unlock_bh(&pn->l2tp_tunnel_idr_lock);
1467+ if (ret)
1468+ return ret == -ENOSPC ? -EEXIST : ret;
1469+
14641470 if (tunnel->fd < 0) {
14651471 ret = l2tp_tunnel_sock_create(net, tunnel->tunnel_id,
14661472 tunnel->peer_tunnel_id, cfg,
@@ -1474,6 +1480,7 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, · 7 unmodified lines
14741480 }
14751481
14761482 sk = sock->sk;
1483+ lock_sock(sk);
14771484 write_lock_bh(&sk->sk_callback_lock);
14781485 ret = l2tp_validate_socket(sk, net, tunnel->encap);
14791486 if (ret < 0)
@@ -1481,24 +1488,6 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, · 1 unmodified line
14811488 rcu_assign_sk_user_data(sk, tunnel);
14821489 write_unlock_bh(&sk->sk_callback_lock);
14831490
1484− tunnel->l2tp_net = net;
1485− pn = l2tp_pernet(net);
1486−
1487− sock_hold(sk);
1488− tunnel->sock = sk;
1489−
1490− spin_lock_bh(&pn->l2tp_tunnel_list_lock);
1491− list_for_each_entry(tunnel_walk, &pn->l2tp_tunnel_list, list) {
1492− if (tunnel_walk->tunnel_id == tunnel->tunnel_id) {
1493− spin_unlock_bh(&pn->l2tp_tunnel_list_lock);
1494− sock_put(sk);
1495− ret = -EEXIST;
1496− goto err_sock;
1497− }
1498− }
1499− list_add_rcu(&tunnel->list, &pn->l2tp_tunnel_list);
1500− spin_unlock_bh(&pn->l2tp_tunnel_list_lock);
1501−
15021491 if (tunnel->encap == L2TP_ENCAPTYPE_UDP) {
15031492 struct udp_tunnel_sock_cfg udp_cfg = {
15041493 .sk_user_data = tunnel,
@@ -1512,9 +1501,16 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, · 7 unmodified lines
15121501
15131502 tunnel->old_sk_destruct = sk->sk_destruct;
15141503 sk->sk_destruct = &l2tp_tunnel_destruct;
1515− lockdep_set_class_and_name(&sk->sk_lock.slock, &l2tp_socket_class,
1516− "l2tp_sock");
15171504 sk->sk_allocation = GFP_ATOMIC;
1505+ release_sock(sk);
1506+
1507+ sock_hold(sk);
1508+ tunnel->sock = sk;
1509+ tunnel->l2tp_net = net;
1510+
1511+ spin_lock_bh(&pn->l2tp_tunnel_idr_lock);
1512+ idr_replace(&pn->l2tp_tunnel_idr, tunnel, tunnel->tunnel_id);
1513+ spin_unlock_bh(&pn->l2tp_tunnel_idr_lock);
15181514
15191515 trace_register_tunnel(tunnel);
15201516
@@ -1523,17 +1519,16 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, · 2 unmodified lines
15231519
15241520 return 0;
15251521
1526−err_sock:
1527− write_lock_bh(&sk->sk_callback_lock);
1528− rcu_assign_sk_user_data(sk, NULL);
15291522 err_inval_sock:
15301523 write_unlock_bh(&sk->sk_callback_lock);
1524+ release_sock(sk);
15311525
15321526 if (tunnel->fd < 0)
15331527 sock_release(sock);
15341528 else
15351529 sockfd_put(sock);
15361530 err:
1531+ l2tp_tunnel_remove(net, tunnel);
15371532 return ret;
15381533 }
15391534 EXPORT_SYMBOL_GPL(l2tp_tunnel_register);
@@ -1647,8 +1642,8 @@ static __net_init int l2tp_init_net(struct net *net) · 107 unmodified lines
16471642 struct l2tp_net *pn = net_generic(net, l2tp_net_id);
16481643 int hash;
16491644
1650− INIT_LIST_HEAD(&pn->l2tp_tunnel_list);
1651− spin_lock_init(&pn->l2tp_tunnel_list_lock);
1645+ idr_init(&pn->l2tp_tunnel_idr);
1646+ spin_lock_init(&pn->l2tp_tunnel_idr_lock);
16521647
16531648 for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)
16541649 INIT_HLIST_HEAD(&pn->l2tp_session_hlist[hash]);
@@ -1662,11 +1657,13 @@ static __net_exit void l2tp_exit_net(struct net *net) · 7 unmodified lines
16621657 {
16631658 struct l2tp_net *pn = l2tp_pernet(net);
16641659 struct l2tp_tunnel *tunnel = NULL;
1660+ unsigned long tunnel_id, tmp;
16651661 int hash;
16661662
16671663 rcu_read_lock_bh();
1668− list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
1669− l2tp_tunnel_delete(tunnel);
1664+ idr_for_each_entry_ul(&pn->l2tp_tunnel_idr, tunnel, tmp, tunnel_id) {
1665+ if (tunnel)
1666+ l2tp_tunnel_delete(tunnel);
16701667 }
16711668 rcu_read_unlock_bh();
16721669
@@ -1676,6 +1673,7 @@ static __net_exit void l2tp_exit_net(struct net *net) · 3 unmodified lines
16761673
16771674 for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++)
16781675 WARN_ON_ONCE(!hlist_empty(&pn->l2tp_session_hlist[hash]));
1676+ idr_destroy(&pn->l2tp_tunnel_idr);
16791677 }
16801678
16811679 static struct pernet_operations l2tp_net_ops = {
net/mac80211/agg-tx.c+5−3
@@ -491,7 +491,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 490 unmodified lines
491491 {
492492 struct tid_ampdu_tx *tid_tx;
493493 struct ieee80211_local *local = sta->local;
494− struct ieee80211_sub_if_data *sdata = sta->sdata;
494+ struct ieee80211_sub_if_data *sdata;
495495 struct ieee80211_ampdu_params params = {
496496 .sta = &sta->sta,
497497 .action = IEEE80211_AMPDU_TX_START,
@@ -511,8 +511,6 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 13 unmodified lines
511511 */
512512 clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
513513
514− ieee80211_agg_stop_txq(sta, tid);
515−
516514 /*
517515 * Make sure no packets are being processed. This ensures that
518516 * we have a valid starting sequence number and that in-flight
@@ -521,6 +519,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 2 unmodified lines
521519 */
522520 synchronize_net();
523521
522+ sdata = sta->sdata;
524523 params.ssn = sta->tid_seq[tid] >> 4;
525524 ret = drv_ampdu_action(local, sdata, &params);
526525 tid_tx->ssn = params.ssn;
@@ -534,6 +533,9 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 7 unmodified lines
534533 */
535534 set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state);
536535 } else if (ret) {
536+ if (!sdata)
537+ return;
538+
537539 ht_dbg(sdata,
538540 "BA request denied - HW unavailable for %pM tid %d\n",
539541 sta->sta.addr, tid);
net/mac80211/cfg.c+7−0
@@ -147,6 +147,7 @@ static int ieee80211_set_ap_mbssid_options(struct ieee80211_sub_if_data *sdata, · 146 unmodified lines
147147 link_conf->bssid_index = 0;
148148 link_conf->nontransmitted = false;
149149 link_conf->ema_ap = false;
150+ link_conf->bssid_indicator = 0;
150151
151152 if (sdata->vif.type != NL80211_IFTYPE_AP || !params.tx_wdev)
152153 return -EINVAL;
@@ -1511,6 +1512,12 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, · 1358 unmodified lines
15111512 kfree(link_conf->ftmr_params);
15121513 link_conf->ftmr_params = NULL;
15131514
1515+ sdata->vif.mbssid_tx_vif = NULL;
1516+ link_conf->bssid_index = 0;
1517+ link_conf->nontransmitted = false;
1518+ link_conf->ema_ap = false;
1519+ link_conf->bssid_indicator = 0;
1520+
15141521 __sta_info_flush(sdata, true);
15151522 ieee80211_free_keys(sdata, true);
15161523
net/mac80211/debugfs_sta.c+3−2
@@ -167,7 +167,7 @@ static ssize_t sta_aqm_read(struct file *file, char __user *userbuf, · 166 unmodified lines
167167 continue;
168168 txqi = to_txq_info(sta->sta.txq[i]);
169169 p += scnprintf(p, bufsz + buf - p,
170− "%d %d %u %u %u %u %u %u %u %u %u 0x%lx(%s%s%s)\n",
170+ "%d %d %u %u %u %u %u %u %u %u %u 0x%lx(%s%s%s%s)\n",
171171 txqi->txq.tid,
172172 txqi->txq.ac,
173173 txqi->tin.backlog_bytes,
@@ -182,7 +182,8 @@ static ssize_t sta_aqm_read(struct file *file, char __user *userbuf, · 8 unmodified lines
182182 txqi->flags,
183183 test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ? "STOP" : "RUN",
184184 test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags) ? " AMPDU" : "",
185− test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags) ? " NO-AMSDU" : "");
185+ test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags) ? " NO-AMSDU" : "",
186+ test_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) ? " DIRTY" : "");
186187 }
187188
188189 rcu_read_unlock();
net/mac80211/driver-ops.c+3−0
@@ -392,6 +392,9 @@ int drv_ampdu_action(struct ieee80211_local *local, · 391 unmodified lines
392392
393393 might_sleep();
394394
395+ if (!sdata)
396+ return -EIO;
397+
395398 sdata = get_bss_sdata(sdata);
396399 if (!check_sdata_in_driver(sdata))
397400 return -EIO;
net/mac80211/driver-ops.h+1−1
@@ -1199,7 +1199,7 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local, · 1198 unmodified lines
11991199
12001200 /* In reconfig don't transmit now, but mark for waking later */
12011201 if (local->in_reconfig) {
1202− set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txq->flags);
1202+ set_bit(IEEE80211_TXQ_DIRTY, &txq->flags);
12031203 return;
12041204 }
12051205
net/mac80211/ht.c+31−0
@@ -391,6 +391,37 @@ void ieee80211_ba_session_work(struct work_struct *work) · 390 unmodified lines
391391
392392 tid_tx = sta->ampdu_mlme.tid_start_tx[tid];
393393 if (!blocked && tid_tx) {
394+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
395+ struct ieee80211_sub_if_data *sdata =
396+ vif_to_sdata(txqi->txq.vif);
397+ struct fq *fq = &sdata->local->fq;
398+
399+ spin_lock_bh(&fq->lock);
400+
401+ /* Allow only frags to be dequeued */
402+ set_bit(IEEE80211_TXQ_STOP, &txqi->flags);
403+
404+ if (!skb_queue_empty(&txqi->frags)) {
405+ /* Fragmented Tx is ongoing, wait for it to
406+ * finish. Reschedule worker to retry later.
407+ */
408+
409+ spin_unlock_bh(&fq->lock);
410+ spin_unlock_bh(&sta->lock);
411+
412+ /* Give the task working on the txq a chance
413+ * to send out the queued frags
414+ */
415+ synchronize_net();
416+
417+ mutex_unlock(&sta->ampdu_mlme.mtx);
418+
419+ ieee80211_queue_work(&sdata->local->hw, work);
420+ return;
421+ }
422+
423+ spin_unlock_bh(&fq->lock);
424+
394425 /*
395426 * Assign it over to the normal tid_tx array
396427 * where it "goes live".
net/mac80211/ieee80211_i.h+1−1
@@ -838,7 +838,7 @@ enum txq_info_flags { · 837 unmodified lines
838838 IEEE80211_TXQ_STOP,
839839 IEEE80211_TXQ_AMPDU,
840840 IEEE80211_TXQ_NO_AMSDU,
841− IEEE80211_TXQ_STOP_NETIF_TX,
841+ IEEE80211_TXQ_DIRTY,
842842 };
843843
844844 /**
net/mac80211/iface.c+3−2
@@ -364,7 +364,9 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, · 363 unmodified lines
364364
365365 /* No support for VLAN with MLO yet */
366366 if (iftype == NL80211_IFTYPE_AP_VLAN &&
367− nsdata->wdev.use_4addr)
367+ sdata->wdev.use_4addr &&
368+ nsdata->vif.type == NL80211_IFTYPE_AP &&
369+ nsdata->vif.valid_links)
368370 return -EOPNOTSUPP;
369371
370372 /*
@@ -2195,7 +2197,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 1824 unmodified lines
21952197
21962198 ret = cfg80211_register_netdevice(ndev);
21972199 if (ret) {
2198− ieee80211_if_free(ndev);
21992200 free_netdev(ndev);
22002201 return ret;
22012202 }
net/mac80211/rx.c+102−123
@@ -4049,6 +4049,58 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx) · 4048 unmodified lines
40494049 #undef CALL_RXH
40504050 }
40514051
4052+static bool
4053+ieee80211_rx_is_valid_sta_link_id(struct ieee80211_sta *sta, u8 link_id)
4054+{
4055+ if (!sta->mlo)
4056+ return false;
4057+
4058+ return !!(sta->valid_links & BIT(link_id));
4059+}
4060+
4061+static bool ieee80211_rx_data_set_link(struct ieee80211_rx_data *rx,
4062+ u8 link_id)
4063+{
4064+ rx->link_id = link_id;
4065+ rx->link = rcu_dereference(rx->sdata->link[link_id]);
4066+
4067+ if (!rx->sta)
4068+ return rx->link;
4069+
4070+ if (!ieee80211_rx_is_valid_sta_link_id(&rx->sta->sta, link_id))
4071+ return false;
4072+
4073+ rx->link_sta = rcu_dereference(rx->sta->link[link_id]);
4074+
4075+ return rx->link && rx->link_sta;
4076+}
4077+
4078+static bool ieee80211_rx_data_set_sta(struct ieee80211_rx_data *rx,
4079+ struct ieee80211_sta *pubsta,
4080+ int link_id)
4081+{
4082+ struct sta_info *sta;
4083+
4084+ sta = container_of(pubsta, struct sta_info, sta);
4085+
4086+ rx->link_id = link_id;
4087+ rx->sta = sta;
4088+
4089+ if (sta) {
4090+ rx->local = sta->sdata->local;
4091+ if (!rx->sdata)
4092+ rx->sdata = sta->sdata;
4093+ rx->link_sta = &sta->deflink;
4094+ }
4095+
4096+ if (link_id < 0)
4097+ rx->link = &rx->sdata->deflink;
4098+ else if (!ieee80211_rx_data_set_link(rx, link_id))
4099+ return false;
4100+
4101+ return true;
4102+}
4103+
40524104 /*
40534105 * This function makes calls into the RX path, therefore
40544106 * it has to be invoked under RCU read lock.
@@ -4057,16 +4109,19 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) · 2 unmodified lines
40574109 {
40584110 struct sk_buff_head frames;
40594111 struct ieee80211_rx_data rx = {
4060− .sta = sta,
4061− .sdata = sta->sdata,
4062− .local = sta->local,
40634112 /* This is OK -- must be QoS data frame */
40644113 .security_idx = tid,
40654114 .seqno_idx = tid,
4066− .link_id = -1,
40674115 };
40684116 struct tid_ampdu_rx *tid_agg_rx;
4069− u8 link_id;
4117+ int link_id = -1;
4118+
4119+ /* FIXME: statistics won't be right with this */
4120+ if (sta->sta.valid_links)
4121+ link_id = ffs(sta->sta.valid_links) - 1;
4122+
4123+ if (!ieee80211_rx_data_set_sta(&rx, &sta->sta, link_id))
4124+ return;
40704125
40714126 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
40724127 if (!tid_agg_rx)
@@ -4086,10 +4141,6 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) · 13 unmodified lines
40864141 };
40874142 drv_event_callback(rx.local, rx.sdata, &event);
40884143 }
4089− /* FIXME: statistics won't be right with this */
4090− link_id = sta->sta.valid_links ? ffs(sta->sta.valid_links) - 1 : 0;
4091− rx.link = rcu_dereference(sta->sdata->link[link_id]);
4092− rx.link_sta = rcu_dereference(sta->link[link_id]);
40934144
40944145 ieee80211_rx_handlers(&rx, &frames);
40954146 }
@@ -4105,7 +4156,6 @@ void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid, · 9 unmodified lines
41054156 /* This is OK -- must be QoS data frame */
41064157 .security_idx = tid,
41074158 .seqno_idx = tid,
4108− .link_id = -1,
41094159 };
41104160 int i, diff;
41114161
@@ -4116,10 +4166,8 @@ void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid, · 4 unmodified lines
41164166
41174167 sta = container_of(pubsta, struct sta_info, sta);
41184168
4119− rx.sta = sta;
4120− rx.sdata = sta->sdata;
4121− rx.link = &rx.sdata->deflink;
4122− rx.local = sta->local;
4169+ if (!ieee80211_rx_data_set_sta(&rx, pubsta, -1))
4170+ return;
41234171
41244172 rcu_read_lock();
41254173 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
@@ -4506,15 +4554,6 @@ void ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata) · 380 unmodified lines
45064554 mutex_unlock(&local->sta_mtx);
45074555 }
45084556
4509−static bool
4510−ieee80211_rx_is_valid_sta_link_id(struct ieee80211_sta *sta, u8 link_id)
4511−{
4512− if (!sta->mlo)
4513− return false;
4514−
4515− return !!(sta->valid_links & BIT(link_id));
4516−}
4517−
45184557 static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,
45194558 struct ieee80211_fast_rx *fast_rx,
45204559 int orig_len)
@@ -4625,7 +4664,6 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, · 104 unmodified lines
46254664 struct sk_buff *skb = rx->skb;
46264665 struct ieee80211_hdr *hdr = (void *)skb->data;
46274666 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
4628− struct sta_info *sta = rx->sta;
46294667 int orig_len = skb->len;
46304668 int hdrlen = ieee80211_hdrlen(hdr->frame_control);
46314669 int snap_offs = hdrlen;
@@ -4637,7 +4675,6 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, · 5 unmodified lines
46374675 u8 da[ETH_ALEN];
46384676 u8 sa[ETH_ALEN];
46394677 } addrs __aligned(2);
4640− struct link_sta_info *link_sta;
46414678 struct ieee80211_sta_rx_stats *stats;
46424679
46434680 /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write
@@ -4740,18 +4777,10 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, · 96 unmodified lines
47404777 drop:
47414778 dev_kfree_skb(skb);
47424779
4743− if (rx->link_id >= 0) {
4744− link_sta = rcu_dereference(sta->link[rx->link_id]);
4745− if (!link_sta)
4746− return true;
4747− } else {
4748− link_sta = &sta->deflink;
4749− }
4750−
47514780 if (fast_rx->uses_rss)
4752− stats = this_cpu_ptr(link_sta->pcpu_rx_stats);
4781+ stats = this_cpu_ptr(rx->link_sta->pcpu_rx_stats);
47534782 else
4754− stats = &link_sta->rx_stats;
4783+ stats = &rx->link_sta->rx_stats;
47554784
47564785 stats->dropped++;
47574786 return true;
@@ -4769,8 +4798,8 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, · 11 unmodified lines
47694798 struct ieee80211_local *local = rx->local;
47704799 struct ieee80211_sub_if_data *sdata = rx->sdata;
47714800 struct ieee80211_hdr *hdr = (void *)skb->data;
4772− struct link_sta_info *link_sta = NULL;
4773− struct ieee80211_link_data *link;
4801+ struct link_sta_info *link_sta = rx->link_sta;
4802+ struct ieee80211_link_data *link = rx->link;
47744803
47754804 rx->skb = skb;
47764805
@@ -4792,35 +4821,6 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, · 15 unmodified lines
47924821 if (!ieee80211_accept_frame(rx))
47934822 return false;
47944823
4795− if (rx->link_id >= 0) {
4796− link = rcu_dereference(rx->sdata->link[rx->link_id]);
4797−
4798− /* we might race link removal */
4799− if (!link)
4800− return true;
4801− rx->link = link;
4802−
4803− if (rx->sta) {
4804− rx->link_sta =
4805− rcu_dereference(rx->sta->link[rx->link_id]);
4806− if (!rx->link_sta)
4807− return true;
4808− }
4809− } else {
4810− if (rx->sta)
4811− rx->link_sta = &rx->sta->deflink;
4812−
4813− rx->link = &sdata->deflink;
4814− }
4815−
4816− if (unlikely(!is_multicast_ether_addr(hdr->addr1) &&
4817− rx->link_id >= 0 && rx->sta && rx->sta->sta.mlo)) {
4818− link_sta = rcu_dereference(rx->sta->link[rx->link_id]);
4819−
4820− if (WARN_ON_ONCE(!link_sta))
4821− return true;
4822− }
4823−
48244824 if (!consume) {
48254825 struct skb_shared_hwtstamps *shwt;
48264826
@@ -4838,9 +4838,12 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, · 11 unmodified lines
48384838 */
48394839 shwt = skb_hwtstamps(rx->skb);
48404840 shwt->hwtstamp = skb_hwtstamps(skb)->hwtstamp;
4841+
4842+ /* Update the hdr pointer to the new skb for translation below */
4843+ hdr = (struct ieee80211_hdr *)rx->skb->data;
48414844 }
48424845
4843− if (unlikely(link_sta)) {
4846+ if (unlikely(rx->sta && rx->sta->sta.mlo)) {
48444847 /* translate to MLD addresses */
48454848 if (ether_addr_equal(link->conf->addr, hdr->addr1))
48464849 ether_addr_copy(hdr->addr1, rx->sdata->vif.addr);
@@ -4870,6 +4873,7 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, · 23 unmodified lines
48704873 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
48714874 struct ieee80211_fast_rx *fast_rx;
48724875 struct ieee80211_rx_data rx;
4876+ int link_id = -1;
48734877
48744878 memset(&rx, 0, sizeof(rx));
48754879 rx.skb = skb;
@@ -4886,12 +4890,8 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, · 10 unmodified lines
48864890 if (!pubsta)
48874891 goto drop;
48884892
4889− rx.sta = container_of(pubsta, struct sta_info, sta);
4890− rx.sdata = rx.sta->sdata;
4891−
4892− if (status->link_valid &&
4893− !ieee80211_rx_is_valid_sta_link_id(pubsta, status->link_id))
4894− goto drop;
4893+ if (status->link_valid)
4894+ link_id = status->link_id;
48954895
48964896 /*
48974897 * TODO: Should the frame be dropped if the right link_id is not
@@ -4900,19 +4900,8 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, · 2 unmodified lines
49004900 * link_id is used only for stats purpose and updating the stats on
49014901 * the deflink is fine?
49024902 */
4903− if (status->link_valid)
4904− rx.link_id = status->link_id;
4905−
4906− if (rx.link_id >= 0) {
4907− struct ieee80211_link_data *link;
4908−
4909− link = rcu_dereference(rx.sdata->link[rx.link_id]);
4910− if (!link)
4911− goto drop;
4912− rx.link = link;
4913− } else {
4914− rx.link = &rx.sdata->deflink;
4915− }
4903+ if (!ieee80211_rx_data_set_sta(&rx, pubsta, link_id))
4904+ goto drop;
49164905
49174906 fast_rx = rcu_dereference(rx.sta->fast_rx);
49184907 if (!fast_rx)
@@ -4930,6 +4919,8 @@ static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx, · 11 unmodified lines
49304919 {
49314920 struct link_sta_info *link_sta;
49324921 struct ieee80211_hdr *hdr = (void *)skb->data;
4922+ struct sta_info *sta;
4923+ int link_id = -1;
49334924
49344925 /*
49354926 * Look up link station first, in case there's a
@@ -4939,24 +4930,19 @@ static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx, · 3 unmodified lines
49394930 */
49404931 link_sta = link_sta_info_get_bss(rx->sdata, hdr->addr2);
49414932 if (link_sta) {
4942− rx->sta = link_sta->sta;
4943− rx->link_id = link_sta->link_id;
4933+ sta = link_sta->sta;
4934+ link_id = link_sta->link_id;
49444935 } else {
49454936 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
49464937
4947− rx->sta = sta_info_get_bss(rx->sdata, hdr->addr2);
4948− if (rx->sta) {
4949− if (status->link_valid &&
4950− !ieee80211_rx_is_valid_sta_link_id(&rx->sta->sta,
4951− status->link_id))
4952− return false;
4953−
4954− rx->link_id = status->link_valid ? status->link_id : -1;
4955− } else {
4956− rx->link_id = -1;
4957− }
4938+ sta = sta_info_get_bss(rx->sdata, hdr->addr2);
4939+ if (status->link_valid)
4940+ link_id = status->link_id;
49584941 }
49594942
4943+ if (!ieee80211_rx_data_set_sta(rx, &sta->sta, link_id))
4944+ return false;
4945+
49604946 return ieee80211_prepare_and_rx_handle(rx, skb, consume);
49614947 }
49624948
@@ -5015,19 +5001,15 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, · 52 unmodified lines
50155001
50165002 if (ieee80211_is_data(fc)) {
50175003 struct sta_info *sta, *prev_sta;
5018− u8 link_id = status->link_id;
5004+ int link_id = -1;
50195005
5020− if (pubsta) {
5021− rx.sta = container_of(pubsta, struct sta_info, sta);
5022− rx.sdata = rx.sta->sdata;
5006+ if (status->link_valid)
5007+ link_id = status->link_id;
50235008
5024− if (status->link_valid &&
5025− !ieee80211_rx_is_valid_sta_link_id(pubsta, link_id))
5009+ if (pubsta) {
5010+ if (!ieee80211_rx_data_set_sta(&rx, pubsta, link_id))
50265011 goto out;
50275012
5028− if (status->link_valid)
5029− rx.link_id = status->link_id;
5030−
50315013 /*
50325014 * In MLO connection, fetch the link_id using addr2
50335015 * when the driver does not pass link_id in status.
@@ -5045,7 +5027,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, · 11 unmodified lines
50455027 if (!link_sta)
50465028 goto out;
50475029
5048− rx.link_id = link_sta->link_id;
5030+ ieee80211_rx_data_set_link(&rx, link_sta->link_id);
50495031 }
50505032
50515033 if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
@@ -5061,30 +5043,27 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, · 9 unmodified lines
50615043 continue;
50625044 }
50635045
5064− if ((status->link_valid &&
5065− !ieee80211_rx_is_valid_sta_link_id(&prev_sta->sta,
5066− link_id)) ||
5067− (!status->link_valid && prev_sta->sta.mlo))
5046+ rx.sdata = prev_sta->sdata;
5047+ if (!ieee80211_rx_data_set_sta(&rx, &prev_sta->sta,
5048+ link_id))
5049+ goto out;
5050+
5051+ if (!status->link_valid && prev_sta->sta.mlo)
50685052 continue;
50695053
5070− rx.link_id = status->link_valid ? link_id : -1;
5071− rx.sta = prev_sta;
5072− rx.sdata = prev_sta->sdata;
50735054 ieee80211_prepare_and_rx_handle(&rx, skb, false);
50745055
50755056 prev_sta = sta;
50765057 }
50775058
50785059 if (prev_sta) {
5079− if ((status->link_valid &&
5080− !ieee80211_rx_is_valid_sta_link_id(&prev_sta->sta,
5081− link_id)) ||
5082− (!status->link_valid && prev_sta->sta.mlo))
5060+ rx.sdata = prev_sta->sdata;
5061+ if (!ieee80211_rx_data_set_sta(&rx, &prev_sta->sta,
5062+ link_id))
50835063 goto out;
50845064
5085− rx.link_id = status->link_valid ? link_id : -1;
5086− rx.sta = prev_sta;
5087− rx.sdata = prev_sta->sdata;
5065+ if (!status->link_valid && prev_sta->sta.mlo)
5066+ goto out;
50885067
50895068 if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
50905069 return;
net/mac80211/tx.c+17−17
@@ -1129,7 +1129,6 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, · 1128 unmodified lines
11291129 struct sk_buff *purge_skb = NULL;
11301130
11311131 if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
1132− info->flags |= IEEE80211_TX_CTL_AMPDU;
11331132 reset_agg_timer = true;
11341133 } else if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) {
11351134 /*
@@ -1161,7 +1160,6 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, · 25 unmodified lines
11611160 if (!tid_tx) {
11621161 /* do nothing, let packet pass through */
11631162 } else if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
1164− info->flags |= IEEE80211_TX_CTL_AMPDU;
11651163 reset_agg_timer = true;
11661164 } else {
11671165 queued = true;
@@ -3677,8 +3675,7 @@ static void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 2509 unmodified lines
36773675 info->band = fast_tx->band;
36783676 info->control.vif = &sdata->vif;
36793677 info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT |
3680− IEEE80211_TX_CTL_DONTFRAG |
3681− (ampdu ? IEEE80211_TX_CTL_AMPDU : 0);
3678+ IEEE80211_TX_CTL_DONTFRAG;
36823679 info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT |
36833680 u32_encode_bits(IEEE80211_LINK_UNSPECIFIED,
36843681 IEEE80211_TX_CTRL_MLO_LINK);
@@ -3783,6 +3780,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, · 98 unmodified lines
37833780 struct ieee80211_tx_data tx;
37843781 ieee80211_tx_result r;
37853782 struct ieee80211_vif *vif = txq->vif;
3783+ int q = vif->hw_queue[txq->ac];
3784+ bool q_stopped;
37863785
37873786 WARN_ON_ONCE(softirq_count() == 0);
37883787
@@ -3790,17 +3789,18 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, · 1 unmodified line
37903789 return NULL;
37913790
37923791 begin:
3793− spin_lock_bh(&fq->lock);
3794−
3795− if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ||
3796− test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags))
3797− goto out;
3792+ spin_lock(&local->queue_stop_reason_lock);
3793+ q_stopped = local->queue_stop_reasons[q];
3794+ spin_unlock(&local->queue_stop_reason_lock);
37983795
3799− if (vif->txqs_stopped[txq->ac]) {
3800− set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags);
3801− goto out;
3796+ if (unlikely(q_stopped)) {
3797+ /* mark for waking later */
3798+ set_bit(IEEE80211_TXQ_DIRTY, &txqi->flags);
3799+ return NULL;
38023800 }
38033801
3802+ spin_lock_bh(&fq->lock);
3803+
38043804 /* Make sure fragments stay together. */
38053805 skb = __skb_dequeue(&txqi->frags);
38063806 if (unlikely(skb)) {
@@ -3810,6 +3810,9 @@ begin: · 3 unmodified lines
38103810 IEEE80211_SKB_CB(skb)->control.flags &=
38113811 ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
38123812 } else {
3813+ if (unlikely(test_bit(IEEE80211_TXQ_STOP, &txqi->flags)))
3814+ goto out;
3815+
38133816 skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func);
38143817 }
38153818
@@ -3860,9 +3863,8 @@ begin: · 44 unmodified lines
38603863 }
38613864
38623865 if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
3863− info->flags |= IEEE80211_TX_CTL_AMPDU;
3864− else
3865− info->flags &= ~IEEE80211_TX_CTL_AMPDU;
3866+ info->flags |= (IEEE80211_TX_CTL_AMPDU |
3867+ IEEE80211_TX_CTL_DONTFRAG);
38663868
38673869 if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) {
38683870 if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {
@@ -4596,8 +4598,6 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata, · 727 unmodified lines
45964598
45974599 info = IEEE80211_SKB_CB(skb);
45984600 memset(info, 0, sizeof(*info));
4599− if (tid_tx)
4600− info->flags |= IEEE80211_TX_CTL_AMPDU;
46014601
46024602 info->hw_queue = sdata->vif.hw_queue[queue];
46034603
net/mac80211/util.c+3−39
@@ -292,22 +292,12 @@ static void wake_tx_push_queue(struct ieee80211_local *local, · 291 unmodified lines
292292 struct ieee80211_sub_if_data *sdata,
293293 struct ieee80211_txq *queue)
294294 {
295− int q = sdata->vif.hw_queue[queue->ac];
296295 struct ieee80211_tx_control control = {
297296 .sta = queue->sta,
298297 };
299298 struct sk_buff *skb;
300− unsigned long flags;
301− bool q_stopped;
302299
303300 while (1) {
304− spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
305− q_stopped = local->queue_stop_reasons[q];
306− spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
307−
308− if (q_stopped)
309− break;
310−
311301 skb = ieee80211_tx_dequeue(&local->hw, queue);
312302 if (!skb)
313303 break;
@@ -347,8 +337,6 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 33 unmodified lines
347337 local_bh_disable();
348338 spin_lock(&fq->lock);
349339
350− sdata->vif.txqs_stopped[ac] = false;
351−
352340 if (!test_bit(SDATA_STATE_RUNNING, &sdata->state))
353341 goto out;
354342
@@ -370,7 +358,7 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 15 unmodified lines
370358 if (ac != txq->ac)
371359 continue;
372360
373− if (!test_and_clear_bit(IEEE80211_TXQ_STOP_NETIF_TX,
361+ if (!test_and_clear_bit(IEEE80211_TXQ_DIRTY,
374362 &txqi->flags))
375363 continue;
376364
@@ -385,7 +373,7 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 8 unmodified lines
385373
386374 txqi = to_txq_info(vif->txq);
387375
388− if (!test_and_clear_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags) ||
376+ if (!test_and_clear_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) ||
389377 (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac)
390378 goto out;
391379
@@ -517,8 +505,6 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue, · 125 unmodified lines
517505 bool refcounted)
518506 {
519507 struct ieee80211_local *local = hw_to_local(hw);
520− struct ieee80211_sub_if_data *sdata;
521− int n_acs = IEEE80211_NUM_ACS;
522508
523509 trace_stop_queue(local, queue, reason);
524510
@@ -530,29 +516,7 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue, · 5 unmodified lines
530516 else
531517 local->q_stop_reasons[queue][reason]++;
532518
533− if (__test_and_set_bit(reason, &local->queue_stop_reasons[queue]))
534− return;
535−
536− if (local->hw.queues < IEEE80211_NUM_ACS)
537− n_acs = 1;
538−
539− rcu_read_lock();
540− list_for_each_entry_rcu(sdata, &local->interfaces, list) {
541− int ac;
542−
543− if (!sdata->dev)
544− continue;
545−
546− for (ac = 0; ac < n_acs; ac++) {
547− if (sdata->vif.hw_queue[ac] == queue ||
548− sdata->vif.cab_queue == queue) {
549− spin_lock(&local->fq.lock);
550− sdata->vif.txqs_stopped[ac] = true;
551− spin_unlock(&local->fq.lock);
552− }
553− }
554− }
555− rcu_read_unlock();
519+ set_bit(reason, &local->queue_stop_reasons[queue]);
556520 }
557521
558522 void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
net/mptcp/pm.c+25−0
@@ -420,6 +420,31 @@ void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) · 419 unmodified lines
420420 }
421421 }
422422
423+/* if sk is ipv4 or ipv6_only allows only same-family local and remote addresses,
424+ * otherwise allow any matching local/remote pair
425+ */
426+bool mptcp_pm_addr_families_match(const struct sock *sk,
427+ const struct mptcp_addr_info *loc,
428+ const struct mptcp_addr_info *rem)
429+{
430+ bool mptcp_is_v4 = sk->sk_family == AF_INET;
431+
432+#if IS_ENABLED(CONFIG_MPTCP_IPV6)
433+ bool loc_is_v4 = loc->family == AF_INET || ipv6_addr_v4mapped(&loc->addr6);
434+ bool rem_is_v4 = rem->family == AF_INET || ipv6_addr_v4mapped(&rem->addr6);
435+
436+ if (mptcp_is_v4)
437+ return loc_is_v4 && rem_is_v4;
438+
439+ if (ipv6_only_sock(sk))
440+ return !loc_is_v4 && !rem_is_v4;
441+
442+ return loc_is_v4 == rem_is_v4;
443+#else
444+ return mptcp_is_v4 && loc->family == AF_INET && rem->family == AF_INET;
445+#endif
446+}
447+
423448 void mptcp_pm_data_reset(struct mptcp_sock *msk)
424449 {
425450 u8 pm_type = mptcp_get_pm_type(sock_net((struct sock *)msk));
net/mptcp/pm_userspace.c+7−0
@@ -294,6 +294,13 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info) · 293 unmodified lines
294294 }
295295
296296 sk = (struct sock *)msk;
297+
298+ if (!mptcp_pm_addr_families_match(sk, &addr_l, &addr_r)) {
299+ GENL_SET_ERR_MSG(info, "families mismatch");
300+ err = -EINVAL;
301+ goto create_err;
302+ }
303+
297304 lock_sock(sk);
298305
299306 err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
net/mptcp/protocol.c+1−1
@@ -98,7 +98,7 @@ static int __mptcp_socket_create(struct mptcp_sock *msk) · 97 unmodified lines
9898 struct socket *ssock;
9999 int err;
100100
101− err = mptcp_subflow_create_socket(sk, &ssock);
101+ err = mptcp_subflow_create_socket(sk, sk->sk_family, &ssock);
102102 if (err)
103103 return err;
104104
net/mptcp/protocol.h+5−1
@@ -641,7 +641,8 @@ bool mptcp_addresses_equal(const struct mptcp_addr_info *a, · 640 unmodified lines
641641 /* called with sk socket lock held */
642642 int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
643643 const struct mptcp_addr_info *remote);
644−int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock);
644+int mptcp_subflow_create_socket(struct sock *sk, unsigned short family,
645+ struct socket **new_sock);
645646 void mptcp_info2sockaddr(const struct mptcp_addr_info *info,
646647 struct sockaddr_storage *addr,
647648 unsigned short family);
@@ -776,6 +777,9 @@ int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info, · 128 unmodified lines
776777 int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info,
777778 bool require_family,
778779 struct mptcp_pm_addr_entry *entry);
780+bool mptcp_pm_addr_families_match(const struct sock *sk,
781+ const struct mptcp_addr_info *loc,
782+ const struct mptcp_addr_info *rem);
779783 void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk);
780784 void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk);
781785 void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, int server_side);
net/mptcp/subflow.c+5−4
@@ -1547,7 +1547,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, · 1546 unmodified lines
15471547 if (!mptcp_is_fully_established(sk))
15481548 goto err_out;
15491549
1550− err = mptcp_subflow_create_socket(sk, &sf);
1550+ err = mptcp_subflow_create_socket(sk, loc->family, &sf);
15511551 if (err)
15521552 goto err_out;
15531553
@@ -1660,7 +1660,9 @@ static void mptcp_subflow_ops_undo_override(struct sock *ssk) · 106 unmodified lines
16601660 #endif
16611661 ssk->sk_prot = &tcp_prot;
16621662 }
1663−int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock)
1663+
1664+int mptcp_subflow_create_socket(struct sock *sk, unsigned short family,
1665+ struct socket **new_sock)
16641666 {
16651667 struct mptcp_subflow_context *subflow;
16661668 struct net *net = sock_net(sk);
@@ -1673,8 +1675,7 @@ int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock) · 6 unmodified lines
16731675 if (unlikely(!sk->sk_socket))
16741676 return -EINVAL;
16751677
1676− err = sock_create_kern(net, sk->sk_family, SOCK_STREAM, IPPROTO_TCP,
1677− &sf);
1678+ err = sock_create_kern(net, family, SOCK_STREAM, IPPROTO_TCP, &sf);
16781679 if (err)
16791680 return err;
16801681
net/netfilter/ipset/ip_set_bitmap_ip.c+2−2
@@ -308,8 +308,8 @@ bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[], · 307 unmodified lines
308308 return -IPSET_ERR_BITMAP_RANGE;
309309
310310 pr_debug("mask_bits %u, netmask %u\n", mask_bits, netmask);
311− hosts = 2 << (32 - netmask - 1);
312− elements = 2 << (netmask - mask_bits - 1);
311+ hosts = 2U << (32 - netmask - 1);
312+ elements = 2UL << (netmask - mask_bits - 1);
313313 }
314314 if (elements > IPSET_BITMAP_MAX_RANGE + 1)
315315 return -IPSET_ERR_BITMAP_RANGE_SIZE;
net/netfilter/nf_conntrack_proto_tcp.c+15−0
@@ -1068,6 +1068,13 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, · 1067 unmodified lines
10681068 ct->proto.tcp.last_flags |=
10691069 IP_CT_EXP_CHALLENGE_ACK;
10701070 }
1071+
1072+ /* possible challenge ack reply to syn */
1073+ if (old_state == TCP_CONNTRACK_SYN_SENT &&
1074+ index == TCP_ACK_SET &&
1075+ dir == IP_CT_DIR_REPLY)
1076+ ct->proto.tcp.last_ack = ntohl(th->ack_seq);
1077+
10711078 spin_unlock_bh(&ct->lock);
10721079 nf_ct_l4proto_log_invalid(skb, ct, state,
10731080 "packet (index %d) in dir %d ignored, state %s",
@@ -1193,6 +1200,14 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, · 119 unmodified lines
11931200 * segments we ignored. */
11941201 goto in_window;
11951202 }
1203+
1204+ /* Reset in response to a challenge-ack we let through earlier */
1205+ if (old_state == TCP_CONNTRACK_SYN_SENT &&
1206+ ct->proto.tcp.last_index == TCP_ACK_SET &&
1207+ ct->proto.tcp.last_dir == IP_CT_DIR_REPLY &&
1208+ ntohl(th->seq) == ct->proto.tcp.last_ack)
1209+ goto in_window;
1210+
11961211 break;
11971212 default:
11981213 /* Keep compilers happy. */
net/netfilter/nft_payload.c+1−1
@@ -63,7 +63,7 @@ nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset, u8 len) · 62 unmodified lines
6363 return false;
6464
6565 if (offset + len > VLAN_ETH_HLEN + vlan_hlen)
66− ethlen -= offset + len - VLAN_ETH_HLEN + vlan_hlen;
66+ ethlen -= offset + len - VLAN_ETH_HLEN - vlan_hlen;
6767
6868 memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen);
6969
net/nfc/llcp_core.c+1−0
@@ -157,6 +157,7 @@ static void local_cleanup(struct nfc_llcp_local *local) · 156 unmodified lines
157157 cancel_work_sync(&local->rx_work);
158158 cancel_work_sync(&local->timeout_work);
159159 kfree_skb(local->rx_pending);
160+ local->rx_pending = NULL;
160161 del_timer_sync(&local->sdreq_timer);
161162 cancel_work_sync(&local->sdreq_timeout_work);
162163 nfc_llcp_free_sdp_tlv_list(&local->pending_sdreqs);
net/rxrpc/call_object.c+1−1
@@ -294,7 +294,7 @@ static void rxrpc_put_call_slot(struct rxrpc_call *call) · 293 unmodified lines
294294 static int rxrpc_connect_call(struct rxrpc_call *call, gfp_t gfp)
295295 {
296296 struct rxrpc_local *local = call->local;
297− int ret = 0;
297+ int ret = -ENOMEM;
298298
299299 _enter("{%d,%lx},", call->debug_id, call->user_call_ID);
300300
net/sched/sch_gred.c+2−0
@@ -377,6 +377,7 @@ static int gred_offload_dump_stats(struct Qdisc *sch) · 376 unmodified lines
377377 /* Even if driver returns failure adjust the stats - in case offload
378378 * ended but driver still wants to adjust the values.
379379 */
380+ sch_tree_lock(sch);
380381 for (i = 0; i < MAX_DPs; i++) {
381382 if (!table->tab[i])
382383 continue;
@@ -393,6 +394,7 @@ static int gred_offload_dump_stats(struct Qdisc *sch) · 10 unmodified lines
393394 sch->qstats.overlimits += hw_stats->stats.qstats[i].overlimits;
394395 }
395396 _bstats_update(&sch->bstats, bytes, packets);
397+ sch_tree_unlock(sch);
396398
397399 kfree(hw_stats);
398400 return ret;
net/sched/sch_htb.c+16−11
@@ -1549,7 +1549,7 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl, · 1548 unmodified lines
15491549 struct tc_htb_qopt_offload offload_opt;
15501550 struct netdev_queue *dev_queue;
15511551 struct Qdisc *q = cl->leaf.q;
1552− struct Qdisc *old = NULL;
1552+ struct Qdisc *old;
15531553 int err;
15541554
15551555 if (cl->level)
@@ -1557,14 +1557,17 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl, · 1 unmodified line
15571557
15581558 WARN_ON(!q);
15591559 dev_queue = htb_offload_get_queue(cl);
1560− old = htb_graft_helper(dev_queue, NULL);
1561− if (destroying)
1562− /* Before HTB is destroyed, the kernel grafts noop_qdisc to
1563− * all queues.
1560+ /* When destroying, caller qdisc_graft grafts the new qdisc and invokes
1561+ * qdisc_put for the qdisc being destroyed. htb_destroy_class_offload
1562+ * does not need to graft or qdisc_put the qdisc being destroyed.
1563+ */
1564+ if (!destroying) {
1565+ old = htb_graft_helper(dev_queue, NULL);
1566+ /* Last qdisc grafted should be the same as cl->leaf.q when
1567+ * calling htb_delete.
15641568 */
1565− WARN_ON(!(old->flags & TCQ_F_BUILTIN));
1566− else
15671569 WARN_ON(old != q);
1570+ }
15681571
15691572 if (cl->parent) {
15701573 _bstats_update(&cl->parent->bstats_bias,
@@ -1581,10 +1584,12 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl, · 10 unmodified lines
15811584 };
15821585 err = htb_offload(qdisc_dev(sch), &offload_opt);
15831586
1584− if (!err || destroying)
1585− qdisc_put(old);
1586− else
1587− htb_graft_helper(dev_queue, old);
1587+ if (!destroying) {
1588+ if (!err)
1589+ qdisc_put(old);
1590+ else
1591+ htb_graft_helper(dev_queue, old);
1592+ }
15881593
15891594 if (last_child)
15901595 return err;
net/sched/sch_taprio.c+3−0
@@ -1700,6 +1700,8 @@ static void taprio_reset(struct Qdisc *sch) · 1699 unmodified lines
17001700 int i;
17011701
17021702 hrtimer_cancel(&q->advance_timer);
1703+ qdisc_synchronize(sch);
1704+
17031705 if (q->qdiscs) {
17041706 for (i = 0; i < dev->num_tx_queues; i++)
17051707 if (q->qdiscs[i])
@@ -1720,6 +1722,7 @@ static void taprio_destroy(struct Qdisc *sch) · 14 unmodified lines
17201722 * happens in qdisc_create(), after taprio_init() has been called.
17211723 */
17221724 hrtimer_cancel(&q->advance_timer);
1725+ qdisc_synchronize(sch);
17231726
17241727 taprio_disable_offload(dev, q, NULL);
17251728
tools/testing/selftests/net/mptcp/userspace_pm.sh+47−0
@@ -752,6 +752,52 @@ test_subflows() · 751 unmodified lines
752752 "$server4_token" > /dev/null 2>&1
753753 }
754754
755+test_subflows_v4_v6_mix()
756+{
757+ # Attempt to add a listener at 10.0.2.1:<subflow-port>
758+ ip netns exec "$ns1" ./pm_nl_ctl listen 10.0.2.1\
759+ $app6_port > /dev/null 2>&1 &
760+ local listener_pid=$!
761+
762+ # ADD_ADDR4 from server to client machine reusing the subflow port on
763+ # the established v6 connection
764+ :>"$client_evts"
765+ ip netns exec "$ns1" ./pm_nl_ctl ann 10.0.2.1 token "$server6_token" id\
766+ $server_addr_id dev ns1eth2 > /dev/null 2>&1
767+ stdbuf -o0 -e0 printf "ADD_ADDR4 id:%d 10.0.2.1 (ns1) => ns2, reuse port\t\t" $server_addr_id
768+ sleep 0.5
769+ verify_announce_event "$client_evts" "$ANNOUNCED" "$client6_token" "10.0.2.1"\
770+ "$server_addr_id" "$app6_port"
771+
772+ # CREATE_SUBFLOW from client to server machine
773+ :>"$client_evts"
774+ ip netns exec "$ns2" ./pm_nl_ctl csf lip 10.0.2.2 lid 23 rip 10.0.2.1 rport\
775+ $app6_port token "$client6_token" > /dev/null 2>&1
776+ sleep 0.5
777+ verify_subflow_events "$client_evts" "$SUB_ESTABLISHED" "$client6_token"\
778+ "$AF_INET" "10.0.2.2" "10.0.2.1" "$app6_port" "23"\
779+ "$server_addr_id" "ns2" "ns1"
780+
781+ # Delete the listener from the server ns, if one was created
782+ kill_wait $listener_pid
783+
784+ sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts")
785+
786+ # DESTROY_SUBFLOW from client to server machine
787+ :>"$client_evts"
788+ ip netns exec "$ns2" ./pm_nl_ctl dsf lip 10.0.2.2 lport "$sport" rip 10.0.2.1 rport\
789+ $app6_port token "$client6_token" > /dev/null 2>&1
790+ sleep 0.5
791+ verify_subflow_events "$client_evts" "$SUB_CLOSED" "$client6_token" \
792+ "$AF_INET" "10.0.2.2" "10.0.2.1" "$app6_port" "23"\
793+ "$server_addr_id" "ns2" "ns1"
794+
795+ # RM_ADDR from server to client machine
796+ ip netns exec "$ns1" ./pm_nl_ctl rem id $server_addr_id token\
797+ "$server6_token" > /dev/null 2>&1
798+ sleep 0.5
799+}
800+
755801 test_prio()
756802 {
757803 local count
@@ -861,6 +907,7 @@ make_connection "v6" · 103 unmodified lines
861907 test_announce
862908 test_remove
863909 test_subflows
910+test_subflows_v4_v6_mix
864911 test_prio
865912 test_listener
866913
tools/testing/selftests/net/toeplitz.c+7−5
@@ -215,7 +215,7 @@ static char *recv_frame(const struct ring_state *ring, char *frame) · 214 unmodified lines
215215 }
216216
217217 /* A single TPACKET_V3 block can hold multiple frames */
218−static void recv_block(struct ring_state *ring)
218+static bool recv_block(struct ring_state *ring)
219219 {
220220 struct tpacket_block_desc *block;
221221 char *frame;
@@ -223,7 +223,7 @@ static void recv_block(struct ring_state *ring) · 1 unmodified line
223223
224224 block = (void *)(ring->mmap + ring->idx * ring_block_sz);
225225 if (!(block->hdr.bh1.block_status & TP_STATUS_USER))
226− return;
226+ return false;
227227
228228 frame = (char *)block;
229229 frame += block->hdr.bh1.offset_to_first_pkt;
@@ -235,6 +235,8 @@ static void recv_block(struct ring_state *ring) · 5 unmodified lines
235235
236236 block->hdr.bh1.block_status = TP_STATUS_KERNEL;
237237 ring->idx = (ring->idx + 1) % ring_block_nr;
238+
239+ return true;
238240 }
239241
240242 /* simple test: sleep once unconditionally and then process all rings */
@@ -245,7 +247,7 @@ static void process_rings(void) · 4 unmodified lines
245247 usleep(1000 * cfg_timeout_msec);
246248
247249 for (i = 0; i < num_cpus; i++)
248− recv_block(&rings[i]);
250+ do {} while (recv_block(&rings[i]));
249251
250252 fprintf(stderr, "count: pass=%u nohash=%u fail=%u\n",
251253 frames_received - frames_nohash - frames_error,
@@ -257,12 +259,12 @@ static char *setup_ring(int fd) · 5 unmodified lines
257259 struct tpacket_req3 req3 = {0};
258260 void *ring;
259261
260− req3.tp_retire_blk_tov = cfg_timeout_msec;
262+ req3.tp_retire_blk_tov = cfg_timeout_msec / 8;
261263 req3.tp_feature_req_word = TP_FT_REQ_FILL_RXHASH;
262264
263265 req3.tp_frame_size = 2048;
264266 req3.tp_frame_nr = 1 << 10;
265− req3.tp_block_nr = 2;
267+ req3.tp_block_nr = 16;
266268
267269 req3.tp_block_size = req3.tp_frame_size * req3.tp_frame_nr;
268270 req3.tp_block_size /= req3.tp_block_nr;
tools/testing/selftests/netfilter/nft_trans_stress.sh+9−7
@@ -10,12 +10,20 @@ · 9 unmodified lines
1010 ksft_skip=4
1111
1212 testns=testns-$(mktemp -u "XXXXXXXX")
13+tmp=""
1314
1415 tables="foo bar baz quux"
1516 global_ret=0
1617 eret=0
1718 lret=0
1819
20+cleanup() {
21+ ip netns pids "$testns" | xargs kill 2>/dev/null
22+ ip netns del "$testns"
23+
24+ rm -f "$tmp"
25+}
26+
1927 check_result()
2028 {
2129 local r=$1
@@ -43,6 +51,7 @@ if [ $? -ne 0 ];then · 21 unmodified lines
4351 exit $ksft_skip
4452 fi
4553
54+trap cleanup EXIT
4655 tmp=$(mktemp)
4756
4857 for table in $tables; do
@@ -139,11 +148,4 @@ done · 90 unmodified lines
139148
140149 check_result $lret "add/delete with nftrace enabled"
141150
142−pkill -9 ping
143−
144−wait
145−
146−rm -f "$tmp"
147−ip netns del "$testns"
148−
149151 exit $global_ret
tools/testing/selftests/netfilter/settings+1−0
@@ -0,0 +1 @@
1+timeout=120

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t