History

Merge tag 'net-6.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Paolo Abeni: "Including fixes from bluetooth. Quite calm week. No new regression under investigation. Current release - regressions: - eth: revert "igb: Disable threaded IRQ for igb_msix_other" Current release - new code bugs: - bluetooth: btintel: direct exception event to bluetooth stack Previous releases - regressions: - core: fix data-races around sk->sk_forward_alloc - netlink: terminate outstanding dump on socket close - mptcp: error out earlier on disconnect - vsock: fix accept_queue memory leak - phylink: ensure PHY momentary link-fails are handled - eth: mlx5: - fix null-ptr-deref in add rule err flow - lock FTE when checking if active - eth: dwmac-mediatek: fix inverted handling of mediatek,mac-wol Previous releases - always broken: - sched: fix u32's systematic failure to free IDR entries for hnodes. - sctp: fix possible UAF in sctp_v6_available() - eth: bonding: add ns target multicast address to slave device - eth: mlx5: fix msix vectors to respect platform limit - eth: icssg-prueth: fix 1 PPS sync" * tag 'net-6.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (38 commits) net: sched: u32: Add test case for systematic hnode IDR leaks selftests: bonding: add ns multicast group testing bonding: add ns target multicast address to slave device net: ti: icssg-prueth: Fix 1 PPS sync stmmac: dwmac-intel-plat: fix call balance of tx_clk handling routines net: Make copy_safe_from_sockptr() match documentation net: stmmac: dwmac-mediatek: Fix inverted handling of mediatek,mac-wol ipmr: Fix access to mfc_cache_list without lock held samples: pktgen: correct dev to DEV net: phylink: ensure PHY momentary link-fails are handled mptcp: pm: use _rcu variant under rcu_read_lock mptcp: hold pm lock when deleting entry mptcp: update local address flags when setting it net: sched: cls_u32: Fix u32's systematic failure to free IDR entries for hnodes. MAINTAINERS: Re-add cancelled Renesas driver sections Revert "igb: Disable threaded IRQ for igb_msix_other" Bluetooth: btintel: Direct exception event to bluetooth stack Bluetooth: hci_core: Fix calling mgmt_device_connected virtio/vsock: Improve MSG_ZEROCOPY error handling vsock: Fix sk_error_queue memory leak ...

Linus Torvalds committed 2 years ago

Commit cfaaa7d2 parents 4abcd80 ca34ace41 files · +543 −109Browse files

Unified · Split

41 files
  1. Documentation/networking/devmem.rst +9 −0
  2. MAINTAINERS +30 −0
  3. drivers/bluetooth/btintel.c +2 −3
  4. drivers/net/bonding/bond_main.c +15 −1
  5. drivers/net/bonding/bond_options.c +81 −1
  6. drivers/net/ethernet/intel/igb/igb_main.c +1 −1
  7. drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +1 −1
  8. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +4 −4
  9. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 −1
  10. drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +4 −0
  11. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +4 −1
  12. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +12 −3
  13. drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +27 −5
  14. drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +17 −8
  15. drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c +2 −2
  16. drivers/net/ethernet/ti/icssg/icssg_prueth.c +11 −2
  17. drivers/net/ethernet/ti/icssg/icssg_prueth.h +12 −0
  18. drivers/net/ethernet/vertexcom/mse102x.c +3 −1
  19. drivers/net/phy/phylink.c +8 −6
  20. include/linux/sockptr.h +3 −1
  21. include/net/bond_options.h +2 −0
  22. net/bluetooth/hci_core.c +0 −2
  23. net/core/sock.c +24 −18
  24. net/dccp/ipv6.c +1 −1
  25. net/ipv4/ipmr_base.c +2 −1
  26. net/ipv6/tcp_ipv6.c +1 −3
  27. net/mptcp/pm_netlink.c +2 −1
  28. net/mptcp/pm_userspace.c +15 −0
  29. net/mptcp/protocol.c +11 −5
  30. net/netlink/af_netlink.c +8 −23
  31. net/netlink/af_netlink.h +0 −2
  32. net/sched/cls_u32.c +14 −4
  33. net/sctp/ipv6.c +13 −6
  34. net/vmw_vsock/af_vsock.c +3 −0
  35. net/vmw_vsock/virtio_transport_common.c +9 −0
  36. samples/pktgen/pktgen_sample01_simple.sh +1 −1
  37. tools/testing/selftests/drivers/net/bonding/bond_options.sh +53 −1
  38. tools/testing/selftests/net/.gitignore +1 −0
  39. tools/testing/selftests/net/Makefile +1 −0
  40. tools/testing/selftests/net/netlink-dumps.c +110 −0
  41. tools/testing/selftests/tc-testing/tc-tests/filters/u32.json +24 −0
Documentation/networking/devmem.rst+9−0
@@ -225,6 +225,15 @@ The user must ensure the tokens are returned to the kernel in a timely manner. · 224 unmodified lines
225225 Failure to do so will exhaust the limited dmabuf that is bound to the RX queue
226226 and will lead to packet drops.
227227
228+The user must pass no more than 128 tokens, with no more than 1024 total frags
229+among the token->token_count across all the tokens. If the user provides more
230+than 1024 frags, the kernel will free up to 1024 frags and return early.
231+
232+The kernel returns the number of actual frags freed. The number of frags freed
233+can be less than the tokens provided by the user in case of:
234+
235+(a) an internal kernel leak bug.
236+(b) the user passed more than 1024 frags.
228237
229238 Implementation & Caveats
230239 ========================
MAINTAINERS+30−0
@@ -19579,6 +19579,17 @@ S: Supported · 19578 unmodified lines
1957919579 F: Documentation/devicetree/bindings/i2c/renesas,iic-emev2.yaml
1958019580 F: drivers/i2c/busses/i2c-emev2.c
1958119581
19582+RENESAS ETHERNET AVB DRIVER
19583+M: Paul Barker <paul.barker.ct@bp.renesas.com>
19584+M: Niklas Söderlund <niklas.soderlund@ragnatech.se>
19585+L: netdev@vger.kernel.org
19586+L: linux-renesas-soc@vger.kernel.org
19587+S: Supported
19588+F: Documentation/devicetree/bindings/net/renesas,etheravb.yaml
19589+F: drivers/net/ethernet/renesas/Kconfig
19590+F: drivers/net/ethernet/renesas/Makefile
19591+F: drivers/net/ethernet/renesas/ravb*
19592+
1958219593 RENESAS ETHERNET SWITCH DRIVER
1958319594 R: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
1958419595 L: netdev@vger.kernel.org
@@ -19628,6 +19639,14 @@ F: Documentation/devicetree/bindings/i2c/renesas,rmobile-iic.yaml · 43 unmodified lines
1962819639 F: drivers/i2c/busses/i2c-rcar.c
1962919640 F: drivers/i2c/busses/i2c-sh_mobile.c
1963019641
19642+RENESAS R-CAR SATA DRIVER
19643+M: Geert Uytterhoeven <geert+renesas@glider.be>
19644+L: linux-ide@vger.kernel.org
19645+L: linux-renesas-soc@vger.kernel.org
19646+S: Supported
19647+F: Documentation/devicetree/bindings/ata/renesas,rcar-sata.yaml
19648+F: drivers/ata/sata_rcar.c
19649+
1963119650 RENESAS R-CAR THERMAL DRIVERS
1963219651 M: Niklas Söderlund <niklas.soderlund@ragnatech.se>
1963319652 L: linux-renesas-soc@vger.kernel.org
@@ -19703,6 +19722,17 @@ S: Supported · 69 unmodified lines
1970319722 F: Documentation/devicetree/bindings/i2c/renesas,rzv2m.yaml
1970419723 F: drivers/i2c/busses/i2c-rzv2m.c
1970519724
19725+RENESAS SUPERH ETHERNET DRIVER
19726+M: Niklas Söderlund <niklas.soderlund@ragnatech.se>
19727+L: netdev@vger.kernel.org
19728+L: linux-renesas-soc@vger.kernel.org
19729+S: Supported
19730+F: Documentation/devicetree/bindings/net/renesas,ether.yaml
19731+F: drivers/net/ethernet/renesas/Kconfig
19732+F: drivers/net/ethernet/renesas/Makefile
19733+F: drivers/net/ethernet/renesas/sh_eth*
19734+F: include/linux/sh_eth.h
19735+
1970619736 RENESAS USB PHY DRIVER
1970719737 M: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
1970819738 L: linux-renesas-soc@vger.kernel.org
drivers/bluetooth/btintel.c+2−3
@@ -3288,13 +3288,12 @@ static int btintel_diagnostics(struct hci_dev *hdev, struct sk_buff *skb) · 3287 unmodified lines
32883288 case INTEL_TLV_TEST_EXCEPTION:
32893289 /* Generate devcoredump from exception */
32903290 if (!hci_devcd_init(hdev, skb->len)) {
3291− hci_devcd_append(hdev, skb);
3291+ hci_devcd_append(hdev, skb_clone(skb, GFP_ATOMIC));
32923292 hci_devcd_complete(hdev);
32933293 } else {
32943294 bt_dev_err(hdev, "Failed to generate devcoredump");
3295− kfree_skb(skb);
32963295 }
3297− return 0;
3296+ break;
32983297 default:
32993298 bt_dev_err(hdev, "Invalid exception type %02X", tlv->val[0]);
33003299 }
drivers/net/bonding/bond_main.c+15−1
@@ -1008,6 +1008,8 @@ static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active, · 1007 unmodified lines
10081008
10091009 if (bond->dev->flags & IFF_UP)
10101010 bond_hw_addr_flush(bond->dev, old_active->dev);
1011+
1012+ bond_slave_ns_maddrs_add(bond, old_active);
10111013 }
10121014
10131015 if (new_active) {
@@ -1024,6 +1026,8 @@ static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active, · 10 unmodified lines
10241026 dev_mc_sync(new_active->dev, bond->dev);
10251027 netif_addr_unlock_bh(bond->dev);
10261028 }
1029+
1030+ bond_slave_ns_maddrs_del(bond, new_active);
10271031 }
10281032 }
10291033
@@ -2341,6 +2345,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, · 1311 unmodified lines
23412345 bond_compute_features(bond);
23422346 bond_set_carrier(bond);
23432347
2348+ /* Needs to be called before bond_select_active_slave(), which will
2349+ * remove the maddrs if the slave is selected as active slave.
2350+ */
2351+ bond_slave_ns_maddrs_add(bond, new_slave);
2352+
23442353 if (bond_uses_primary(bond)) {
23452354 block_netpoll_tx();
23462355 bond_select_active_slave(bond);
@@ -2350,7 +2359,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, · 3 unmodified lines
23502359 if (bond_mode_can_use_xmit_hash(bond))
23512360 bond_update_slave_arr(bond, NULL);
23522361
2353−
23542362 if (!slave_dev->netdev_ops->ndo_bpf ||
23552363 !slave_dev->netdev_ops->ndo_xdp_xmit) {
23562364 if (bond->xdp_prog) {
@@ -2548,6 +2556,12 @@ static int __bond_release_one(struct net_device *bond_dev, · 191 unmodified lines
25482556 if (oldcurrent == slave)
25492557 bond_change_active_slave(bond, NULL);
25502558
2559+ /* Must be called after bond_change_active_slave () as the slave
2560+ * might change from an active slave to a backup slave. Then it is
2561+ * necessary to clear the maddrs on the backup slave.
2562+ */
2563+ bond_slave_ns_maddrs_del(bond, slave);
2564+
25512565 if (bond_is_lb(bond)) {
25522566 /* Must be called only after the slave has been
25532567 * detached from the list and the curr_active_slave
drivers/net/bonding/bond_options.c+81−1
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/sched/signal.h>
1616
1717 #include <net/bonding.h>
18+#include <net/ndisc.h>
1819
1920 static int bond_option_active_slave_set(struct bonding *bond,
2021 const struct bond_opt_value *newval);
@@ -1234,6 +1235,68 @@ static int bond_option_arp_ip_targets_set(struct bonding *bond, · 1213 unmodified lines
12341235 }
12351236
12361237 #if IS_ENABLED(CONFIG_IPV6)
1238+static bool slave_can_set_ns_maddr(const struct bonding *bond, struct slave *slave)
1239+{
1240+ return BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP &&
1241+ !bond_is_active_slave(slave) &&
1242+ slave->dev->flags & IFF_MULTICAST;
1243+}
1244+
1245+static void slave_set_ns_maddrs(struct bonding *bond, struct slave *slave, bool add)
1246+{
1247+ struct in6_addr *targets = bond->params.ns_targets;
1248+ char slot_maddr[MAX_ADDR_LEN];
1249+ int i;
1250+
1251+ if (!slave_can_set_ns_maddr(bond, slave))
1252+ return;
1253+
1254+ for (i = 0; i < BOND_MAX_NS_TARGETS; i++) {
1255+ if (ipv6_addr_any(&targets[i]))
1256+ break;
1257+
1258+ if (!ndisc_mc_map(&targets[i], slot_maddr, slave->dev, 0)) {
1259+ if (add)
1260+ dev_mc_add(slave->dev, slot_maddr);
1261+ else
1262+ dev_mc_del(slave->dev, slot_maddr);
1263+ }
1264+ }
1265+}
1266+
1267+void bond_slave_ns_maddrs_add(struct bonding *bond, struct slave *slave)
1268+{
1269+ if (!bond->params.arp_validate)
1270+ return;
1271+ slave_set_ns_maddrs(bond, slave, true);
1272+}
1273+
1274+void bond_slave_ns_maddrs_del(struct bonding *bond, struct slave *slave)
1275+{
1276+ if (!bond->params.arp_validate)
1277+ return;
1278+ slave_set_ns_maddrs(bond, slave, false);
1279+}
1280+
1281+static void slave_set_ns_maddr(struct bonding *bond, struct slave *slave,
1282+ struct in6_addr *target, struct in6_addr *slot)
1283+{
1284+ char target_maddr[MAX_ADDR_LEN], slot_maddr[MAX_ADDR_LEN];
1285+
1286+ if (!bond->params.arp_validate || !slave_can_set_ns_maddr(bond, slave))
1287+ return;
1288+
1289+ /* remove the previous maddr from slave */
1290+ if (!ipv6_addr_any(slot) &&
1291+ !ndisc_mc_map(slot, slot_maddr, slave->dev, 0))
1292+ dev_mc_del(slave->dev, slot_maddr);
1293+
1294+ /* add new maddr on slave if target is set */
1295+ if (!ipv6_addr_any(target) &&
1296+ !ndisc_mc_map(target, target_maddr, slave->dev, 0))
1297+ dev_mc_add(slave->dev, target_maddr);
1298+}
1299+
12371300 static void _bond_options_ns_ip6_target_set(struct bonding *bond, int slot,
12381301 struct in6_addr *target,
12391302 unsigned long last_rx)
@@ -1243,8 +1306,10 @@ static void _bond_options_ns_ip6_target_set(struct bonding *bond, int slot, · 3 unmodified lines
12431306 struct slave *slave;
12441307
12451308 if (slot >= 0 && slot < BOND_MAX_NS_TARGETS) {
1246− bond_for_each_slave(bond, slave, iter)
1309+ bond_for_each_slave(bond, slave, iter) {
12471310 slave->target_last_arp_rx[slot] = last_rx;
1311+ slave_set_ns_maddr(bond, slave, target, &targets[slot]);
1312+ }
12481313 targets[slot] = *target;
12491314 }
12501315 }
@@ -1296,15 +1361,30 @@ static int bond_option_ns_ip6_targets_set(struct bonding *bond, · 45 unmodified lines
12961361 {
12971362 return -EPERM;
12981363 }
1364+
1365+static void slave_set_ns_maddrs(struct bonding *bond, struct slave *slave, bool add) {}
1366+
1367+void bond_slave_ns_maddrs_add(struct bonding *bond, struct slave *slave) {}
1368+
1369+void bond_slave_ns_maddrs_del(struct bonding *bond, struct slave *slave) {}
12991370 #endif
13001371
13011372 static int bond_option_arp_validate_set(struct bonding *bond,
13021373 const struct bond_opt_value *newval)
13031374 {
1375+ bool changed = !!bond->params.arp_validate != !!newval->value;
1376+ struct list_head *iter;
1377+ struct slave *slave;
1378+
13041379 netdev_dbg(bond->dev, "Setting arp_validate to %s (%llu)\n",
13051380 newval->string, newval->value);
13061381 bond->params.arp_validate = newval->value;
13071382
1383+ if (changed) {
1384+ bond_for_each_slave(bond, slave, iter)
1385+ slave_set_ns_maddrs(bond, slave, !!bond->params.arp_validate);
1386+ }
1387+
13081388 return 0;
13091389 }
13101390
drivers/net/ethernet/intel/igb/igb_main.c+1−1
@@ -907,7 +907,7 @@ static int igb_request_msix(struct igb_adapter *adapter) · 906 unmodified lines
907907 int i, err = 0, vector = 0, free_vector = 0;
908908
909909 err = request_irq(adapter->msix_entries[vector].vector,
910− igb_msix_other, IRQF_NO_THREAD, netdev->name, adapter);
910+ igb_msix_other, 0, netdev->name, adapter);
911911 if (err)
912912 goto err_out;
913913
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c+1−1
@@ -866,7 +866,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv, · 865 unmodified lines
866866 return 0;
867867
868868 err_rule:
869− mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, zone_rule->attr, zone_rule->mh);
869+ mlx5_tc_ct_entry_destroy_mod_hdr(ct_priv, attr, zone_rule->mh);
870870 mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id);
871871 err_mod_hdr:
872872 kfree(attr);
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c+4−4
@@ -660,7 +660,7 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx, · 659 unmodified lines
660660 while (remaining > 0) {
661661 skb_frag_t *frag = &record->frags[i];
662662
663− get_page(skb_frag_page(frag));
663+ page_ref_inc(skb_frag_page(frag));
664664 remaining -= skb_frag_size(frag);
665665 info->frags[i++] = *frag;
666666 }
@@ -763,7 +763,7 @@ void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq, · 96 unmodified lines
763763 stats = sq->stats;
764764
765765 mlx5e_tx_dma_unmap(sq->pdev, dma);
766− put_page(wi->resync_dump_frag_page);
766+ page_ref_dec(wi->resync_dump_frag_page);
767767 stats->tls_dump_packets++;
768768 stats->tls_dump_bytes += wi->num_bytes;
769769 }
@@ -816,12 +816,12 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, · 46 unmodified lines
816816
817817 err_out:
818818 for (; i < info.nr_frags; i++)
819− /* The put_page() here undoes the page ref obtained in tx_sync_info_get().
819+ /* The page_ref_dec() here undoes the page ref obtained in tx_sync_info_get().
820820 * Page refs obtained for the DUMP WQEs above (by page_ref_add) will be
821821 * released only upon their completions (or in mlx5e_free_txqsq_descs,
822822 * if channel closes).
823823 */
824− put_page(skb_frag_page(&info.frags[i]));
824+ page_ref_dec(skb_frag_page(&info.frags[i]));
825825
826826 return MLX5E_KTLS_SYNC_FAIL;
827827 }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+2−1
@@ -4267,7 +4267,8 @@ void mlx5e_set_xdp_feature(struct net_device *netdev) · 4266 unmodified lines
42674267 struct mlx5e_params *params = &priv->channels.params;
42684268 xdp_features_t val;
42694269
4270− if (params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
4270+ if (!netdev->netdev_ops->ndo_bpf ||
4271+ params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
42714272 xdp_clear_features_flag(netdev);
42724273 return;
42734274 }
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c+4−0
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #include "en.h"
3737 #include "en/port.h"
3838 #include "eswitch.h"
39+#include "lib/mlx5.h"
3940
4041 static int mlx5e_test_health_info(struct mlx5e_priv *priv)
4142 {
@@ -247,6 +248,9 @@ static int mlx5e_cond_loopback(struct mlx5e_priv *priv) · 205 unmodified lines
247248 if (is_mdev_switchdev_mode(priv->mdev))
248249 return -EOPNOTSUPP;
249250
251+ if (mlx5_get_sd(priv->mdev))
252+ return -EOPNOTSUPP;
253+
250254 return 0;
251255 }
252256
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+4−1
@@ -2527,8 +2527,11 @@ static void __esw_offloads_unload_rep(struct mlx5_eswitch *esw, · 2526 unmodified lines
25272527 struct mlx5_eswitch_rep *rep, u8 rep_type)
25282528 {
25292529 if (atomic_cmpxchg(&rep->rep_data[rep_type].state,
2530− REP_LOADED, REP_REGISTERED) == REP_LOADED)
2530+ REP_LOADED, REP_REGISTERED) == REP_LOADED) {
2531+ if (rep_type == REP_ETH)
2532+ __esw_offloads_unload_rep(esw, rep, REP_IB);
25312533 esw->offloads.rep_ops[rep_type]->unload(rep);
2534+ }
25322535 }
25332536
25342537 static void __unload_reps_all_vport(struct mlx5_eswitch *esw, u8 rep_type)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+12−3
@@ -2105,13 +2105,22 @@ lookup_fte_locked(struct mlx5_flow_group *g, · 2104 unmodified lines
21052105 fte_tmp = NULL;
21062106 goto out;
21072107 }
2108+
2109+ nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
2110+
21082111 if (!fte_tmp->node.active) {
2112+ up_write_ref_node(&fte_tmp->node, false);
2113+
2114+ if (take_write)
2115+ up_write_ref_node(&g->node, false);
2116+ else
2117+ up_read_ref_node(&g->node);
2118+
21092119 tree_put_node(&fte_tmp->node, false);
2110− fte_tmp = NULL;
2111− goto out;
2120+
2121+ return NULL;
21122122 }
21132123
2114− nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
21152124 out:
21162125 if (take_write)
21172126 up_write_ref_node(&g->node, false);
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c+27−5
@@ -593,9 +593,11 @@ static void irq_pool_free(struct mlx5_irq_pool *pool) · 592 unmodified lines
593593 kvfree(pool);
594594 }
595595
596−static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec)
596+static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec,
597+ bool dynamic_vec)
597598 {
598599 struct mlx5_irq_table *table = dev->priv.irq_table;
600+ int sf_vec_available = sf_vec;
599601 int num_sf_ctrl;
600602 int err;
601603
@@ -616,6 +618,13 @@ static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec) · 14 unmodified lines
616618 num_sf_ctrl = DIV_ROUND_UP(mlx5_sf_max_functions(dev),
617619 MLX5_SFS_PER_CTRL_IRQ);
618620 num_sf_ctrl = min_t(int, MLX5_IRQ_CTRL_SF_MAX, num_sf_ctrl);
621+ if (!dynamic_vec && (num_sf_ctrl + 1) > sf_vec_available) {
622+ mlx5_core_dbg(dev,
623+ "Not enough IRQs for SFs control and completion pool, required=%d avail=%d\n",
624+ num_sf_ctrl + 1, sf_vec_available);
625+ return 0;
626+ }
627+
619628 table->sf_ctrl_pool = irq_pool_alloc(dev, pcif_vec, num_sf_ctrl,
620629 "mlx5_sf_ctrl",
621630 MLX5_EQ_SHARE_IRQ_MIN_CTRL,
@@ -624,9 +633,11 @@ static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec) · 2 unmodified lines
624633 err = PTR_ERR(table->sf_ctrl_pool);
625634 goto err_pf;
626635 }
627− /* init sf_comp_pool */
636+ sf_vec_available -= num_sf_ctrl;
637+
638+ /* init sf_comp_pool, remaining vectors are for the SF completions */
628639 table->sf_comp_pool = irq_pool_alloc(dev, pcif_vec + num_sf_ctrl,
629− sf_vec - num_sf_ctrl, "mlx5_sf_comp",
640+ sf_vec_available, "mlx5_sf_comp",
630641 MLX5_EQ_SHARE_IRQ_MIN_COMP,
631642 MLX5_EQ_SHARE_IRQ_MAX_COMP);
632643 if (IS_ERR(table->sf_comp_pool)) {
@@ -715,6 +726,7 @@ int mlx5_irq_table_get_num_comp(struct mlx5_irq_table *table) · 82 unmodified lines
715726 int mlx5_irq_table_create(struct mlx5_core_dev *dev)
716727 {
717728 int num_eqs = mlx5_max_eq_cap_get(dev);
729+ bool dynamic_vec;
718730 int total_vec;
719731 int pcif_vec;
720732 int req_vec;
@@ -724,21 +736,31 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev) · 3 unmodified lines
724736 if (mlx5_core_is_sf(dev))
725737 return 0;
726738
739+ /* PCI PF vectors usage is limited by online cpus, device EQs and
740+ * PCI MSI-X capability.
741+ */
727742 pcif_vec = MLX5_CAP_GEN(dev, num_ports) * num_online_cpus() + 1;
728743 pcif_vec = min_t(int, pcif_vec, num_eqs);
744+ pcif_vec = min_t(int, pcif_vec, pci_msix_vec_count(dev->pdev));
729745
730746 total_vec = pcif_vec;
731747 if (mlx5_sf_max_functions(dev))
732748 total_vec += MLX5_MAX_MSIX_PER_SF * mlx5_sf_max_functions(dev);
733749 total_vec = min_t(int, total_vec, pci_msix_vec_count(dev->pdev));
734− pcif_vec = min_t(int, pcif_vec, pci_msix_vec_count(dev->pdev));
735750
736751 req_vec = pci_msix_can_alloc_dyn(dev->pdev) ? 1 : total_vec;
737752 n = pci_alloc_irq_vectors(dev->pdev, 1, req_vec, PCI_IRQ_MSIX);
738753 if (n < 0)
739754 return n;
740755
741− err = irq_pools_init(dev, total_vec - pcif_vec, pcif_vec);
756+ /* Further limit vectors of the pools based on platform for non dynamic case */
757+ dynamic_vec = pci_msix_can_alloc_dyn(dev->pdev);
758+ if (!dynamic_vec) {
759+ pcif_vec = min_t(int, n, pcif_vec);
760+ total_vec = min_t(int, n, total_vec);
761+ }
762+
763+ err = irq_pools_init(dev, total_vec - pcif_vec, pcif_vec, dynamic_vec);
742764 if (err)
743765 pci_free_irq_vectors(dev->pdev);
744766
drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c+17−8
@@ -108,7 +108,12 @@ static int intel_eth_plat_probe(struct platform_device *pdev) · 107 unmodified lines
108108 if (IS_ERR(dwmac->tx_clk))
109109 return PTR_ERR(dwmac->tx_clk);
110110
111− clk_prepare_enable(dwmac->tx_clk);
111+ ret = clk_prepare_enable(dwmac->tx_clk);
112+ if (ret) {
113+ dev_err(&pdev->dev,
114+ "Failed to enable tx_clk\n");
115+ return ret;
116+ }
112117
113118 /* Check and configure TX clock rate */
114119 rate = clk_get_rate(dwmac->tx_clk);
@@ -119,7 +124,7 @@ static int intel_eth_plat_probe(struct platform_device *pdev) · 4 unmodified lines
119124 if (ret) {
120125 dev_err(&pdev->dev,
121126 "Failed to set tx_clk\n");
122− return ret;
127+ goto err_tx_clk_disable;
123128 }
124129 }
125130 }
@@ -133,7 +138,7 @@ static int intel_eth_plat_probe(struct platform_device *pdev) · 7 unmodified lines
133138 if (ret) {
134139 dev_err(&pdev->dev,
135140 "Failed to set clk_ptp_ref\n");
136− return ret;
141+ goto err_tx_clk_disable;
137142 }
138143 }
139144 }
@@ -149,12 +154,15 @@ static int intel_eth_plat_probe(struct platform_device *pdev) · 9 unmodified lines
149154 }
150155
151156 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
152− if (ret) {
153− clk_disable_unprepare(dwmac->tx_clk);
154− return ret;
155− }
157+ if (ret)
158+ goto err_tx_clk_disable;
156159
157160 return 0;
161+
162+err_tx_clk_disable:
163+ if (dwmac->data->tx_clk_en)
164+ clk_disable_unprepare(dwmac->tx_clk);
165+ return ret;
158166 }
159167
160168 static void intel_eth_plat_remove(struct platform_device *pdev)
@@ -162,7 +170,8 @@ static void intel_eth_plat_remove(struct platform_device *pdev) · 1 unmodified line
162170 struct intel_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);
163171
164172 stmmac_pltfr_remove(pdev);
165− clk_disable_unprepare(dwmac->tx_clk);
173+ if (dwmac->data->tx_clk_en)
174+ clk_disable_unprepare(dwmac->tx_clk);
166175 }
167176
168177 static struct platform_driver intel_eth_plat_driver = {
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c+2−2
@@ -589,9 +589,9 @@ static int mediatek_dwmac_common_data(struct platform_device *pdev, · 588 unmodified lines
589589
590590 plat->mac_interface = priv_plat->phy_mode;
591591 if (priv_plat->mac_wol)
592− plat->flags |= STMMAC_FLAG_USE_PHY_WOL;
593− else
594592 plat->flags &= ~STMMAC_FLAG_USE_PHY_WOL;
593+ else
594+ plat->flags |= STMMAC_FLAG_USE_PHY_WOL;
595595 plat->riwt_off = 1;
596596 plat->maxmtu = ETH_DATA_LEN;
597597 plat->host_dma_width = priv_plat->variant->dma_bit_mask;
drivers/net/ethernet/ti/icssg/icssg_prueth.c+11−2
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/if_hsr.h>
1717 #include <linux/if_vlan.h>
1818 #include <linux/interrupt.h>
19+#include <linux/io-64-nonatomic-hi-lo.h>
1920 #include <linux/kernel.h>
2021 #include <linux/mfd/syscon.h>
2122 #include <linux/module.h>
@@ -411,6 +412,8 @@ static int prueth_perout_enable(void *clockops_data, · 389 unmodified lines
411412 struct prueth_emac *emac = clockops_data;
412413 u32 reduction_factor = 0, offset = 0;
413414 struct timespec64 ts;
415+ u64 current_cycle;
416+ u64 start_offset;
414417 u64 ns_period;
415418
416419 if (!on)
@@ -449,8 +452,14 @@ static int prueth_perout_enable(void *clockops_data, · 32 unmodified lines
449452 writel(reduction_factor, emac->prueth->shram.va +
450453 TIMESYNC_FW_WC_SYNCOUT_REDUCTION_FACTOR_OFFSET);
451454
452− writel(0, emac->prueth->shram.va +
453− TIMESYNC_FW_WC_SYNCOUT_START_TIME_CYCLECOUNT_OFFSET);
455+ current_cycle = icssg_read_time(emac->prueth->shram.va +
456+ TIMESYNC_FW_WC_CYCLECOUNT_OFFSET);
457+
458+ /* Rounding of current_cycle count to next second */
459+ start_offset = roundup(current_cycle, MSEC_PER_SEC);
460+
461+ hi_lo_writeq(start_offset, emac->prueth->shram.va +
462+ TIMESYNC_FW_WC_SYNCOUT_START_TIME_CYCLECOUNT_OFFSET);
454463
455464 return 0;
456465 }
drivers/net/ethernet/ti/icssg/icssg_prueth.h+12−0
@@ -330,6 +330,18 @@ static inline int prueth_emac_slice(struct prueth_emac *emac) · 329 unmodified lines
330330 extern const struct ethtool_ops icssg_ethtool_ops;
331331 extern const struct dev_pm_ops prueth_dev_pm_ops;
332332
333+static inline u64 icssg_read_time(const void __iomem *addr)
334+{
335+ u32 low, high;
336+
337+ do {
338+ high = readl(addr + 4);
339+ low = readl(addr);
340+ } while (high != readl(addr + 4));
341+
342+ return low + ((u64)high << 32);
343+}
344+
333345 /* Classifier helpers */
334346 void icssg_class_set_mac_addr(struct regmap *miig_rt, int slice, u8 *mac);
335347 void icssg_class_set_host_mac_addr(struct regmap *miig_rt, const u8 *mac);
drivers/net/ethernet/vertexcom/mse102x.c+3−1
@@ -437,13 +437,15 @@ static void mse102x_tx_work(struct work_struct *work) · 436 unmodified lines
437437 mse = &mses->mse102x;
438438
439439 while ((txb = skb_dequeue(&mse->txq))) {
440+ unsigned int len = max_t(unsigned int, txb->len, ETH_ZLEN);
441+
440442 mutex_lock(&mses->lock);
441443 ret = mse102x_tx_pkt_spi(mse, txb, work_timeout);
442444 mutex_unlock(&mses->lock);
443445 if (ret) {
444446 mse->ndev->stats.tx_dropped++;
445447 } else {
446− mse->ndev->stats.tx_bytes += txb->len;
448+ mse->ndev->stats.tx_bytes += len;
447449 mse->ndev->stats.tx_packets++;
448450 }
449451
drivers/net/phy/phylink.c+8−6
@@ -78,7 +78,7 @@ struct phylink { · 77 unmodified lines
7878 unsigned int pcs_neg_mode;
7979 unsigned int pcs_state;
8080
81− bool mac_link_dropped;
81+ bool link_failed;
8282 bool using_mac_select_pcs;
8383
8484 struct sfp_bus *sfp_bus;
@@ -1475,9 +1475,9 @@ static void phylink_resolve(struct work_struct *w) · 1390 unmodified lines
14751475 cur_link_state = pl->old_link_state;
14761476
14771477 if (pl->phylink_disable_state) {
1478− pl->mac_link_dropped = false;
1478+ pl->link_failed = false;
14791479 link_state.link = false;
1480− } else if (pl->mac_link_dropped) {
1480+ } else if (pl->link_failed) {
14811481 link_state.link = false;
14821482 retrigger = true;
14831483 } else {
@@ -1572,7 +1572,7 @@ static void phylink_resolve(struct work_struct *w) · 88 unmodified lines
15721572 phylink_link_up(pl, link_state);
15731573 }
15741574 if (!link_state.link && retrigger) {
1575− pl->mac_link_dropped = false;
1575+ pl->link_failed = false;
15761576 queue_work(system_power_efficient_wq, &pl->resolve);
15771577 }
15781578 mutex_unlock(&pl->state_mutex);
@@ -1835,6 +1835,8 @@ static void phylink_phy_change(struct phy_device *phydev, bool up) · 256 unmodified lines
18351835 pl->phy_state.pause |= MLO_PAUSE_RX;
18361836 pl->phy_state.interface = phydev->interface;
18371837 pl->phy_state.link = up;
1838+ if (!up)
1839+ pl->link_failed = true;
18381840 mutex_unlock(&pl->state_mutex);
18391841
18401842 phylink_run_resolve(pl);
@@ -2158,7 +2160,7 @@ EXPORT_SYMBOL_GPL(phylink_disconnect_phy); · 317 unmodified lines
21582160 static void phylink_link_changed(struct phylink *pl, bool up, const char *what)
21592161 {
21602162 if (!up)
2161− pl->mac_link_dropped = true;
2163+ pl->link_failed = true;
21622164 phylink_run_resolve(pl);
21632165 phylink_dbg(pl, "%s link %s\n", what, up ? "up" : "down");
21642166 }
@@ -2792,7 +2794,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl, · 627 unmodified lines
27922794 * link will cycle.
27932795 */
27942796 if (manual_changed) {
2795− pl->mac_link_dropped = true;
2797+ pl->link_failed = true;
27962798 phylink_run_resolve(pl);
27972799 }
27982800
include/linux/sockptr.h+3−1
@@ -77,7 +77,9 @@ static inline int copy_safe_from_sockptr(void *dst, size_t ksize, · 76 unmodified lines
7777 {
7878 if (optlen < ksize)
7979 return -EINVAL;
80− return copy_from_sockptr(dst, optval, ksize);
80+ if (copy_from_sockptr(dst, optval, ksize))
81+ return -EFAULT;
82+ return 0;
8183 }
8284
8385 static inline int copy_struct_from_sockptr(void *dst, size_t ksize,
include/net/bond_options.h+2−0
@@ -161,5 +161,7 @@ void bond_option_arp_ip_targets_clear(struct bonding *bond); · 160 unmodified lines
161161 #if IS_ENABLED(CONFIG_IPV6)
162162 void bond_option_ns_ip6_targets_clear(struct bonding *bond);
163163 #endif
164+void bond_slave_ns_maddrs_add(struct bonding *bond, struct slave *slave);
165+void bond_slave_ns_maddrs_del(struct bonding *bond, struct slave *slave);
164166
165167 #endif /* _NET_BOND_OPTIONS_H */
net/bluetooth/hci_core.c+0−2
@@ -3788,8 +3788,6 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) · 3787 unmodified lines
37883788
37893789 hci_dev_lock(hdev);
37903790 conn = hci_conn_hash_lookup_handle(hdev, handle);
3791− if (conn && hci_dev_test_flag(hdev, HCI_MGMT))
3792− mgmt_device_connected(hdev, conn, NULL, 0);
37933791 hci_dev_unlock(hdev);
37943792
37953793 if (conn) {
net/core/sock.c+24−18
@@ -1052,32 +1052,34 @@ static int sock_reserve_memory(struct sock *sk, int bytes) · 1051 unmodified lines
10521052
10531053 #ifdef CONFIG_PAGE_POOL
10541054
1055−/* This is the number of tokens that the user can SO_DEVMEM_DONTNEED in
1056− * 1 syscall. The limit exists to limit the amount of memory the kernel
1057− * allocates to copy these tokens.
1055+/* This is the number of tokens and frags that the user can SO_DEVMEM_DONTNEED
1056+ * in 1 syscall. The limit exists to limit the amount of memory the kernel
1057+ * allocates to copy these tokens, and to prevent looping over the frags for
1058+ * too long.
10581059 */
10591060 #define MAX_DONTNEED_TOKENS 128
1061+#define MAX_DONTNEED_FRAGS 1024
10601062
10611063 static noinline_for_stack int
10621064 sock_devmem_dontneed(struct sock *sk, sockptr_t optval, unsigned int optlen)
10631065 {
10641066 unsigned int num_tokens, i, j, k, netmem_num = 0;
10651067 struct dmabuf_token *tokens;
1068+ int ret = 0, num_frags = 0;
10661069 netmem_ref netmems[16];
1067− int ret = 0;
10681070
10691071 if (!sk_is_tcp(sk))
10701072 return -EBADF;
10711073
1072− if (optlen % sizeof(struct dmabuf_token) ||
1074+ if (optlen % sizeof(*tokens) ||
10731075 optlen > sizeof(*tokens) * MAX_DONTNEED_TOKENS)
10741076 return -EINVAL;
10751077
1076− tokens = kvmalloc_array(optlen, sizeof(*tokens), GFP_KERNEL);
1078+ num_tokens = optlen / sizeof(*tokens);
1079+ tokens = kvmalloc_array(num_tokens, sizeof(*tokens), GFP_KERNEL);
10771080 if (!tokens)
10781081 return -ENOMEM;
10791082
1080− num_tokens = optlen / sizeof(struct dmabuf_token);
10811083 if (copy_from_sockptr(tokens, optval, optlen)) {
10821084 kvfree(tokens);
10831085 return -EFAULT;
@@ -1086,24 +1088,28 @@ sock_devmem_dontneed(struct sock *sk, sockptr_t optval, unsigned int optlen) · 2 unmodified lines
10861088 xa_lock_bh(&sk->sk_user_frags);
10871089 for (i = 0; i < num_tokens; i++) {
10881090 for (j = 0; j < tokens[i].token_count; j++) {
1091+ if (++num_frags > MAX_DONTNEED_FRAGS)
1092+ goto frag_limit_reached;
1093+
10891094 netmem_ref netmem = (__force netmem_ref)__xa_erase(
10901095 &sk->sk_user_frags, tokens[i].token_start + j);
10911096
1092− if (netmem &&
1093− !WARN_ON_ONCE(!netmem_is_net_iov(netmem))) {
1094− netmems[netmem_num++] = netmem;
1095− if (netmem_num == ARRAY_SIZE(netmems)) {
1096− xa_unlock_bh(&sk->sk_user_frags);
1097− for (k = 0; k < netmem_num; k++)
1098− WARN_ON_ONCE(!napi_pp_put_page(netmems[k]));
1099− netmem_num = 0;
1100− xa_lock_bh(&sk->sk_user_frags);
1101− }
1102− ret++;
1097+ if (!netmem || WARN_ON_ONCE(!netmem_is_net_iov(netmem)))
1098+ continue;
1099+
1100+ netmems[netmem_num++] = netmem;
1101+ if (netmem_num == ARRAY_SIZE(netmems)) {
1102+ xa_unlock_bh(&sk->sk_user_frags);
1103+ for (k = 0; k < netmem_num; k++)
1104+ WARN_ON_ONCE(!napi_pp_put_page(netmems[k]));
1105+ netmem_num = 0;
1106+ xa_lock_bh(&sk->sk_user_frags);
11031107 }
1108+ ret++;
11041109 }
11051110 }
11061111
1112+frag_limit_reached:
11071113 xa_unlock_bh(&sk->sk_user_frags);
11081114 for (k = 0; k < netmem_num; k++)
11091115 WARN_ON_ONCE(!napi_pp_put_page(netmems[k]));
net/dccp/ipv6.c+1−1
@@ -618,7 +618,7 @@ static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) · 617 unmodified lines
618618 by tcp. Feel free to propose better solution.
619619 --ANK (980728)
620620 */
621− if (np->rxopt.all)
621+ if (np->rxopt.all && sk->sk_state != DCCP_LISTEN)
622622 opt_skb = skb_clone_and_charge_r(skb, sk);
623623
624624 if (sk->sk_state == DCCP_OPEN) { /* Fast path */
net/ipv4/ipmr_base.c+2−1
@@ -310,7 +310,8 @@ int mr_table_dump(struct mr_table *mrt, struct sk_buff *skb, · 309 unmodified lines
310310 if (filter->filter_set)
311311 flags |= NLM_F_DUMP_FILTERED;
312312
313− list_for_each_entry_rcu(mfc, &mrt->mfc_cache_list, list) {
313+ list_for_each_entry_rcu(mfc, &mrt->mfc_cache_list, list,
314+ lockdep_rtnl_is_held()) {
314315 if (e < s_e)
315316 goto next_entry;
316317 if (filter->dev &&
net/ipv6/tcp_ipv6.c+1−3
@@ -1618,7 +1618,7 @@ int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) · 1617 unmodified lines
16181618 by tcp. Feel free to propose better solution.
16191619 --ANK (980728)
16201620 */
1621− if (np->rxopt.all)
1621+ if (np->rxopt.all && sk->sk_state != TCP_LISTEN)
16221622 opt_skb = skb_clone_and_charge_r(skb, sk);
16231623
16241624 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */
@@ -1656,8 +1656,6 @@ int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) · 31 unmodified lines
16561656 if (reason)
16571657 goto reset;
16581658 }
1659− if (opt_skb)
1660− __kfree_skb(opt_skb);
16611659 return 0;
16621660 }
16631661 } else
net/mptcp/pm_netlink.c+2−1
@@ -524,7 +524,8 @@ __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) · 523 unmodified lines
524524 {
525525 struct mptcp_pm_addr_entry *entry;
526526
527− list_for_each_entry(entry, &pernet->local_addr_list, list) {
527+ list_for_each_entry_rcu(entry, &pernet->local_addr_list, list,
528+ lockdep_is_held(&pernet->lock)) {
528529 if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port))
529530 return entry;
530531 }
net/mptcp/pm_userspace.c+15−0
@@ -308,14 +308,17 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) · 307 unmodified lines
308308
309309 lock_sock(sk);
310310
311+ spin_lock_bh(&msk->pm.lock);
311312 match = mptcp_userspace_pm_lookup_addr_by_id(msk, id_val);
312313 if (!match) {
313314 GENL_SET_ERR_MSG(info, "address with specified id not found");
315+ spin_unlock_bh(&msk->pm.lock);
314316 release_sock(sk);
315317 goto out;
316318 }
317319
318320 list_move(&match->list, &free_list);
321+ spin_unlock_bh(&msk->pm.lock);
319322
320323 mptcp_pm_remove_addrs(msk, &free_list);
321324
@@ -560,6 +563,7 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info) · 238 unmodified lines
560563 struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];
561564 struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR];
562565 struct net *net = sock_net(skb->sk);
566+ struct mptcp_pm_addr_entry *entry;
563567 struct mptcp_sock *msk;
564568 int ret = -EINVAL;
565569 struct sock *sk;
@@ -601,6 +605,17 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info) · 35 unmodified lines
601605 if (loc.flags & MPTCP_PM_ADDR_FLAG_BACKUP)
602606 bkup = 1;
603607
608+ spin_lock_bh(&msk->pm.lock);
609+ list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) {
610+ if (mptcp_addresses_equal(&entry->addr, &loc.addr, false)) {
611+ if (bkup)
612+ entry->flags |= MPTCP_PM_ADDR_FLAG_BACKUP;
613+ else
614+ entry->flags &= ~MPTCP_PM_ADDR_FLAG_BACKUP;
615+ }
616+ }
617+ spin_unlock_bh(&msk->pm.lock);
618+
604619 lock_sock(sk);
605620 ret = mptcp_pm_nl_mp_prio_send_ack(msk, &loc.addr, &rem.addr, bkup);
606621 release_sock(sk);
net/mptcp/protocol.c+11−5
@@ -2082,7 +2082,8 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) · 2081 unmodified lines
20822082 slow = lock_sock_fast(ssk);
20832083 WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf);
20842084 WRITE_ONCE(tcp_sk(ssk)->window_clamp, window_clamp);
2085− tcp_cleanup_rbuf(ssk, 1);
2085+ if (tcp_can_send_ack(ssk))
2086+ tcp_cleanup_rbuf(ssk, 1);
20862087 unlock_sock_fast(ssk, slow);
20872088 }
20882089 }
@@ -2205,7 +2206,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, · 116 unmodified lines
22052206 cmsg_flags = MPTCP_CMSG_INQ;
22062207
22072208 while (copied < len) {
2208− int bytes_read;
2209+ int err, bytes_read;
22092210
22102211 bytes_read = __mptcp_recvmsg_mskq(msk, msg, len - copied, flags, &tss, &cmsg_flags);
22112212 if (unlikely(bytes_read < 0)) {
@@ -2267,9 +2268,16 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, · 55 unmodified lines
22672268 }
22682269
22692270 pr_debug("block timeout %ld\n", timeo);
2270− sk_wait_data(sk, &timeo, NULL);
2271+ mptcp_rcv_space_adjust(msk, copied);
2272+ err = sk_wait_data(sk, &timeo, NULL);
2273+ if (err < 0) {
2274+ err = copied ? : err;
2275+ goto out_err;
2276+ }
22712277 }
22722278
2279+ mptcp_rcv_space_adjust(msk, copied);
2280+
22732281 out_err:
22742282 if (cmsg_flags && copied >= 0) {
22752283 if (cmsg_flags & MPTCP_CMSG_TS)
@@ -2285,8 +2293,6 @@ out_err: · 9 unmodified lines
22852293 pr_debug("msk=%p rx queue empty=%d:%d copied=%d\n",
22862294 msk, skb_queue_empty_lockless(&sk->sk_receive_queue),
22872295 skb_queue_empty(&msk->receive_queue), copied);
2288− if (!(flags & MSG_PEEK))
2289− mptcp_rcv_space_adjust(msk, copied);
22902296
22912297 release_sock(sk);
22922298 return copied;
net/netlink/af_netlink.c+8−23
@@ -393,15 +393,6 @@ static void netlink_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) · 392 unmodified lines
393393
394394 static void netlink_sock_destruct(struct sock *sk)
395395 {
396− struct netlink_sock *nlk = nlk_sk(sk);
397−
398− if (nlk->cb_running) {
399− if (nlk->cb.done)
400− nlk->cb.done(&nlk->cb);
401− module_put(nlk->cb.module);
402− kfree_skb(nlk->cb.skb);
403− }
404−
405396 skb_queue_purge(&sk->sk_receive_queue);
406397
407398 if (!sock_flag(sk, SOCK_DEAD)) {
@@ -414,14 +405,6 @@ static void netlink_sock_destruct(struct sock *sk) · 6 unmodified lines
414405 WARN_ON(nlk_sk(sk)->groups);
415406 }
416407
417−static void netlink_sock_destruct_work(struct work_struct *work)
418−{
419− struct netlink_sock *nlk = container_of(work, struct netlink_sock,
420− work);
421−
422− sk_free(&nlk->sk);
423−}
424−
425408 /* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on
426409 * SMP. Look, when several writers sleep and reader wakes them up, all but one
427410 * immediately hit write lock and grab all the cpus. Exclusive sleep solves
@@ -731,12 +714,6 @@ static void deferred_put_nlk_sk(struct rcu_head *head) · 303 unmodified lines
731714 if (!refcount_dec_and_test(&sk->sk_refcnt))
732715 return;
733716
734− if (nlk->cb_running && nlk->cb.done) {
735− INIT_WORK(&nlk->work, netlink_sock_destruct_work);
736− schedule_work(&nlk->work);
737− return;
738− }
739−
740717 sk_free(sk);
741718 }
742719
@@ -788,6 +765,14 @@ static int netlink_release(struct socket *sock) · 45 unmodified lines
788765 NETLINK_URELEASE, &n);
789766 }
790767
768+ /* Terminate any outstanding dump */
769+ if (nlk->cb_running) {
770+ if (nlk->cb.done)
771+ nlk->cb.done(&nlk->cb);
772+ module_put(nlk->cb.module);
773+ kfree_skb(nlk->cb.skb);
774+ }
775+
791776 module_put(nlk->module);
792777
793778 if (netlink_is_kernel(sk)) {
net/netlink/af_netlink.h+0−2
@@ -4,7 +4,6 @@ · 3 unmodified lines
44
55 #include <linux/rhashtable.h>
66 #include <linux/atomic.h>
7−#include <linux/workqueue.h>
87 #include <net/sock.h>
98
109 /* flags */
@@ -50,7 +49,6 @@ struct netlink_sock { · 39 unmodified lines
5049
5150 struct rhash_head node;
5251 struct rcu_head rcu;
53− struct work_struct work;
5452 };
5553
5654 static inline struct netlink_sock *nlk_sk(struct sock *sk)
net/sched/cls_u32.c+14−4
@@ -92,6 +92,16 @@ struct tc_u_common { · 91 unmodified lines
9292 long knodes;
9393 };
9494
95+static u32 handle2id(u32 h)
96+{
97+ return ((h & 0x80000000) ? ((h >> 20) & 0x7FF) : h);
98+}
99+
100+static u32 id2handle(u32 id)
101+{
102+ return (id | 0x800U) << 20;
103+}
104+
95105 static inline unsigned int u32_hash_fold(__be32 key,
96106 const struct tc_u32_sel *sel,
97107 u8 fshift)
@@ -310,7 +320,7 @@ static u32 gen_new_htid(struct tc_u_common *tp_c, struct tc_u_hnode *ptr) · 212 unmodified lines
310320 int id = idr_alloc_cyclic(&tp_c->handle_idr, ptr, 1, 0x7FF, GFP_KERNEL);
311321 if (id < 0)
312322 return 0;
313− return (id | 0x800U) << 20;
323+ return id2handle(id);
314324 }
315325
316326 static struct hlist_head *tc_u_common_hash;
@@ -360,7 +370,7 @@ static int u32_init(struct tcf_proto *tp) · 43 unmodified lines
360370 return -ENOBUFS;
361371
362372 refcount_set(&root_ht->refcnt, 1);
363− root_ht->handle = tp_c ? gen_new_htid(tp_c, root_ht) : 0x80000000;
373+ root_ht->handle = tp_c ? gen_new_htid(tp_c, root_ht) : id2handle(0);
364374 root_ht->prio = tp->prio;
365375 root_ht->is_root = true;
366376 idr_init(&root_ht->handle_idr);
@@ -612,7 +622,7 @@ static int u32_destroy_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht, · 245 unmodified lines
612622 if (phn == ht) {
613623 u32_clear_hw_hnode(tp, ht, extack);
614624 idr_destroy(&ht->handle_idr);
615− idr_remove(&tp_c->handle_idr, ht->handle);
625+ idr_remove(&tp_c->handle_idr, handle2id(ht->handle));
616626 RCU_INIT_POINTER(*hn, ht->next);
617627 kfree_rcu(ht, rcu);
618628 return 0;
@@ -989,7 +999,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, · 370 unmodified lines
989999
9901000 err = u32_replace_hw_hnode(tp, ht, userflags, extack);
9911001 if (err) {
992− idr_remove(&tp_c->handle_idr, handle);
1002+ idr_remove(&tp_c->handle_idr, handle2id(handle));
9931003 kfree(ht);
9941004 return err;
9951005 }
net/sctp/ipv6.c+13−6
@@ -683,7 +683,7 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) · 682 unmodified lines
683683 struct sock *sk = &sp->inet.sk;
684684 struct net *net = sock_net(sk);
685685 struct net_device *dev = NULL;
686− int type;
686+ int type, res, bound_dev_if;
687687
688688 type = ipv6_addr_type(in6);
689689 if (IPV6_ADDR_ANY == type)
@@ -697,14 +697,21 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) · 7 unmodified lines
697697 if (!(type & IPV6_ADDR_UNICAST))
698698 return 0;
699699
700− if (sk->sk_bound_dev_if) {
701− dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);
700+ rcu_read_lock();
701+ bound_dev_if = READ_ONCE(sk->sk_bound_dev_if);
702+ if (bound_dev_if) {
703+ res = 0;
704+ dev = dev_get_by_index_rcu(net, bound_dev_if);
702705 if (!dev)
703− return 0;
706+ goto out;
704707 }
705708
706− return ipv6_can_nonlocal_bind(net, &sp->inet) ||
707− ipv6_chk_addr(net, in6, dev, 0);
709+ res = ipv6_can_nonlocal_bind(net, &sp->inet) ||
710+ ipv6_chk_addr(net, in6, dev, 0);
711+
712+out:
713+ rcu_read_unlock();
714+ return res;
708715 }
709716
710717 /* This function checks if the address is a valid address to be used for
net/vmw_vsock/af_vsock.c+3−0
@@ -836,6 +836,9 @@ static void vsock_sk_destruct(struct sock *sk) · 835 unmodified lines
836836 {
837837 struct vsock_sock *vsk = vsock_sk(sk);
838838
839+ /* Flush MSG_ZEROCOPY leftovers. */
840+ __skb_queue_purge(&sk->sk_error_queue);
841+
839842 vsock_deassign_transport(vsk);
840843
841844 /* When clearing these addresses, there's no need to set the family and
net/vmw_vsock/virtio_transport_common.c+9−0
@@ -400,6 +400,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, · 399 unmodified lines
400400 if (virtio_transport_init_zcopy_skb(vsk, skb,
401401 info->msg,
402402 can_zcopy)) {
403+ kfree_skb(skb);
403404 ret = -ENOMEM;
404405 break;
405406 }
@@ -1513,6 +1514,14 @@ virtio_transport_recv_listen(struct sock *sk, struct sk_buff *skb, · 1107 unmodified lines
15131514 return -ENOMEM;
15141515 }
15151516
1517+ /* __vsock_release() might have already flushed accept_queue.
1518+ * Subsequent enqueues would lead to a memory leak.
1519+ */
1520+ if (sk->sk_shutdown == SHUTDOWN_MASK) {
1521+ virtio_transport_reset_no_sock(t, skb);
1522+ return -ESHUTDOWN;
1523+ }
1524+
15161525 child = vsock_create_connected(sk);
15171526 if (!child) {
15181527 virtio_transport_reset_no_sock(t, skb);
samples/pktgen/pktgen_sample01_simple.sh+1−1
@@ -76,7 +76,7 @@ if [ -n "$DST_PORT" ]; then · 75 unmodified lines
7676 pg_set $DEV "udp_dst_max $UDP_DST_MAX"
7777 fi
7878
79−[ ! -z "$UDP_CSUM" ] && pg_set $dev "flag UDPCSUM"
79+[ ! -z "$UDP_CSUM" ] && pg_set $DEV "flag UDPCSUM"
8080
8181 # Setup random UDP port src range
8282 pg_set $DEV "flag UDPSRC_RND"
tools/testing/selftests/drivers/net/bonding/bond_options.sh+53−1
@@ -11,6 +11,8 @@ ALL_TESTS=" · 10 unmodified lines
1111
1212 lib_dir=$(dirname "$0")
1313 source ${lib_dir}/bond_topo_3d1c.sh
14+c_maddr="33:33:00:00:00:10"
15+g_maddr="33:33:00:00:02:54"
1416
1517 skip_prio()
1618 {
@@ -240,6 +242,54 @@ arp_validate_test() · 223 unmodified lines
240242 done
241243 }
242244
245+# Testing correct multicast groups are added to slaves for ns targets
246+arp_validate_mcast()
247+{
248+ RET=0
249+ local arp_valid=$(cmd_jq "ip -n ${s_ns} -j -d link show bond0" ".[].linkinfo.info_data.arp_validate")
250+ local active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave")
251+
252+ for i in $(seq 0 2); do
253+ maddr_list=$(ip -n ${s_ns} maddr show dev eth${i})
254+
255+ # arp_valid == 0 or active_slave should not join any maddrs
256+ if { [ "$arp_valid" == "null" ] || [ "eth${i}" == ${active_slave} ]; } && \
257+ echo "$maddr_list" | grep -qE "${c_maddr}|${g_maddr}"; then
258+ RET=1
259+ check_err 1 "arp_valid $arp_valid active_slave $active_slave, eth$i has mcast group"
260+ # arp_valid != 0 and backup_slave should join both maddrs
261+ elif [ "$arp_valid" != "null" ] && [ "eth${i}" != ${active_slave} ] && \
262+ ( ! echo "$maddr_list" | grep -q "${c_maddr}" || \
263+ ! echo "$maddr_list" | grep -q "${m_maddr}"); then
264+ RET=1
265+ check_err 1 "arp_valid $arp_valid active_slave $active_slave, eth$i has mcast group"
266+ fi
267+ done
268+
269+ # Do failover
270+ ip -n ${s_ns} link set ${active_slave} down
271+ # wait for active link change
272+ slowwait 2 active_slave_changed $active_slave
273+ active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave")
274+
275+ for i in $(seq 0 2); do
276+ maddr_list=$(ip -n ${s_ns} maddr show dev eth${i})
277+
278+ # arp_valid == 0 or active_slave should not join any maddrs
279+ if { [ "$arp_valid" == "null" ] || [ "eth${i}" == ${active_slave} ]; } && \
280+ echo "$maddr_list" | grep -qE "${c_maddr}|${g_maddr}"; then
281+ RET=1
282+ check_err 1 "arp_valid $arp_valid active_slave $active_slave, eth$i has mcast group"
283+ # arp_valid != 0 and backup_slave should join both maddrs
284+ elif [ "$arp_valid" != "null" ] && [ "eth${i}" != ${active_slave} ] && \
285+ ( ! echo "$maddr_list" | grep -q "${c_maddr}" || \
286+ ! echo "$maddr_list" | grep -q "${m_maddr}"); then
287+ RET=1
288+ check_err 1 "arp_valid $arp_valid active_slave $active_slave, eth$i has mcast group"
289+ fi
290+ done
291+}
292+
243293 arp_validate_arp()
244294 {
245295 local mode=$1
@@ -261,8 +311,10 @@ arp_validate_ns() · 15 unmodified lines
261311 fi
262312
263313 for val in $(seq 0 6); do
264− arp_validate_test "mode $mode arp_interval 100 ns_ip6_target ${g_ip6} arp_validate $val"
314+ arp_validate_test "mode $mode arp_interval 100 ns_ip6_target ${g_ip6},${c_ip6} arp_validate $val"
265315 log_test "arp_validate" "$mode ns_ip6_target arp_validate $val"
316+ arp_validate_mcast
317+ log_test "arp_validate" "join mcast group"
266318 done
267319 }
268320
tools/testing/selftests/net/.gitignore+1−0
@@ -19,6 +19,7 @@ log.txt · 18 unmodified lines
1919 msg_oob
2020 msg_zerocopy
2121 ncdevmem
22+netlink-dumps
2223 nettest
2324 psock_fanout
2425 psock_snd
tools/testing/selftests/net/Makefile+1−0
@@ -78,6 +78,7 @@ TEST_PROGS += test_vxlan_vnifiltering.sh · 77 unmodified lines
7878 TEST_GEN_FILES += io_uring_zerocopy_tx
7979 TEST_PROGS += io_uring_zerocopy_tx.sh
8080 TEST_GEN_FILES += bind_bhash
81+TEST_GEN_PROGS += netlink-dumps
8182 TEST_GEN_PROGS += sk_bind_sendto_listen
8283 TEST_GEN_PROGS += sk_connect_zero_addr
8384 TEST_GEN_PROGS += sk_so_peek_off
tools/testing/selftests/net/netlink-dumps.c+110−0
@@ -0,0 +1,110 @@
1+// SPDX-License-Identifier: GPL-2.0
2+
3+#define _GNU_SOURCE
4+
5+#include <fcntl.h>
6+#include <stdio.h>
7+#include <string.h>
8+#include <sys/socket.h>
9+#include <sys/stat.h>
10+#include <sys/syscall.h>
11+#include <sys/types.h>
12+#include <unistd.h>
13+
14+#include <linux/genetlink.h>
15+#include <linux/netlink.h>
16+#include <linux/mqueue.h>
17+
18+#include "../kselftest_harness.h"
19+
20+static const struct {
21+ struct nlmsghdr nlhdr;
22+ struct genlmsghdr genlhdr;
23+ struct nlattr ahdr;
24+ __u16 val;
25+ __u16 pad;
26+} dump_policies = {
27+ .nlhdr = {
28+ .nlmsg_len = sizeof(dump_policies),
29+ .nlmsg_type = GENL_ID_CTRL,
30+ .nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_DUMP,
31+ .nlmsg_seq = 1,
32+ },
33+ .genlhdr = {
34+ .cmd = CTRL_CMD_GETPOLICY,
35+ .version = 2,
36+ },
37+ .ahdr = {
38+ .nla_len = 6,
39+ .nla_type = CTRL_ATTR_FAMILY_ID,
40+ },
41+ .val = GENL_ID_CTRL,
42+ .pad = 0,
43+};
44+
45+// Sanity check for the test itself, make sure the dump doesn't fit in one msg
46+TEST(test_sanity)
47+{
48+ int netlink_sock;
49+ char buf[8192];
50+ ssize_t n;
51+
52+ netlink_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
53+ ASSERT_GE(netlink_sock, 0);
54+
55+ n = send(netlink_sock, &dump_policies, sizeof(dump_policies), 0);
56+ ASSERT_EQ(n, sizeof(dump_policies));
57+
58+ n = recv(netlink_sock, buf, sizeof(buf), MSG_DONTWAIT);
59+ ASSERT_GE(n, sizeof(struct nlmsghdr));
60+
61+ n = recv(netlink_sock, buf, sizeof(buf), MSG_DONTWAIT);
62+ ASSERT_GE(n, sizeof(struct nlmsghdr));
63+
64+ close(netlink_sock);
65+}
66+
67+TEST(close_in_progress)
68+{
69+ int netlink_sock;
70+ ssize_t n;
71+
72+ netlink_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
73+ ASSERT_GE(netlink_sock, 0);
74+
75+ n = send(netlink_sock, &dump_policies, sizeof(dump_policies), 0);
76+ ASSERT_EQ(n, sizeof(dump_policies));
77+
78+ close(netlink_sock);
79+}
80+
81+TEST(close_with_ref)
82+{
83+ char cookie[NOTIFY_COOKIE_LEN] = {};
84+ int netlink_sock, mq_fd;
85+ struct sigevent sigev;
86+ ssize_t n;
87+
88+ netlink_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
89+ ASSERT_GE(netlink_sock, 0);
90+
91+ n = send(netlink_sock, &dump_policies, sizeof(dump_policies), 0);
92+ ASSERT_EQ(n, sizeof(dump_policies));
93+
94+ mq_fd = syscall(__NR_mq_open, "sed", O_CREAT | O_WRONLY, 0600, 0);
95+ ASSERT_GE(mq_fd, 0);
96+
97+ memset(&sigev, 0, sizeof(sigev));
98+ sigev.sigev_notify = SIGEV_THREAD;
99+ sigev.sigev_value.sival_ptr = cookie;
100+ sigev.sigev_signo = netlink_sock;
101+
102+ syscall(__NR_mq_notify, mq_fd, &sigev);
103+
104+ close(netlink_sock);
105+
106+ // give mqueue time to fire
107+ usleep(100 * 1000);
108+}
109+
110+TEST_HARNESS_MAIN
tools/testing/selftests/tc-testing/tc-tests/filters/u32.json+24−0
@@ -329,5 +329,29 @@ · 328 unmodified lines
329329 "teardown": [
330330 "$TC qdisc del dev $DEV1 parent root drr"
331331 ]
332+ },
333+ {
334+ "id": "1234",
335+ "name": "Exercise IDR leaks by creating/deleting a filter many (2048) times",
336+ "category": [
337+ "filter",
338+ "u32"
339+ ],
340+ "plugins": {
341+ "requires": "nsPlugin"
342+ },
343+ "setup": [
344+ "$TC qdisc add dev $DEV1 parent root handle 10: drr",
345+ "$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 u32 match ip src 0.0.0.2/32 action drop",
346+ "$TC filter add dev $DEV1 parent 10:0 protocol ip prio 3 u32 match ip src 0.0.0.3/32 action drop"
347+ ],
348+ "cmdUnderTest": "bash -c 'for i in {1..2048} ;do echo filter delete dev $DEV1 pref 3;echo filter add dev $DEV1 parent 10:0 protocol ip prio 3 u32 match ip src 0.0.0.3/32 action drop;done | $TC -b -'",
349+ "expExitCode": "0",
350+ "verifyCmd": "$TC filter show dev $DEV1",
351+ "matchPattern": "protocol ip pref 3 u32",
352+ "matchCount": "3",
353+ "teardown": [
354+ "$TC qdisc del dev $DEV1 parent root drr"
355+ ]
332356 }
333357 ]

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