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
225Failure to do so will exhaust the limited dmabuf that is bound to the RX queue225Failure to do so will exhaust the limited dmabuf that is bound to the RX queue
226and will lead to packet drops.226and will lead to packet drops.
227 227
228The user must pass no more than 128 tokens, with no more than 1024 total frags
229among the token->token_count across all the tokens. If the user provides more
230than 1024 frags, the kernel will free up to 1024 frags and return early.
231
232The kernel returns the number of actual frags freed. The number of frags freed
233can 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.
228 237
229Implementation & Caveats238Implementation & Caveats
230========================239========================
MAINTAINERS+30−0
@@ -19579,6 +19579,17 @@ S: Supported · 19578 unmodified lines
19579F: Documentation/devicetree/bindings/i2c/renesas,iic-emev2.yaml19579F: Documentation/devicetree/bindings/i2c/renesas,iic-emev2.yaml
19580F: drivers/i2c/busses/i2c-emev2.c19580F: drivers/i2c/busses/i2c-emev2.c
19581 19581
19582RENESAS ETHERNET AVB DRIVER
19583M: Paul Barker <paul.barker.ct@bp.renesas.com>
19584M: Niklas Söderlund <niklas.soderlund@ragnatech.se>
19585L: netdev@vger.kernel.org
19586L: linux-renesas-soc@vger.kernel.org
19587S: Supported
19588F: Documentation/devicetree/bindings/net/renesas,etheravb.yaml
19589F: drivers/net/ethernet/renesas/Kconfig
19590F: drivers/net/ethernet/renesas/Makefile
19591F: drivers/net/ethernet/renesas/ravb*
19592
19582RENESAS ETHERNET SWITCH DRIVER19593RENESAS ETHERNET SWITCH DRIVER
19583R: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>19594R: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
19584L: netdev@vger.kernel.org19595L: netdev@vger.kernel.org
@@ -19628,6 +19639,14 @@ F: Documentation/devicetree/bindings/i2c/renesas,rmobile-iic.yaml · 43 unmodified lines
19628F: drivers/i2c/busses/i2c-rcar.c19639F: drivers/i2c/busses/i2c-rcar.c
19629F: drivers/i2c/busses/i2c-sh_mobile.c19640F: drivers/i2c/busses/i2c-sh_mobile.c
19630 19641
19642RENESAS R-CAR SATA DRIVER
19643M: Geert Uytterhoeven <geert+renesas@glider.be>
19644L: linux-ide@vger.kernel.org
19645L: linux-renesas-soc@vger.kernel.org
19646S: Supported
19647F: Documentation/devicetree/bindings/ata/renesas,rcar-sata.yaml
19648F: drivers/ata/sata_rcar.c
19649
19631RENESAS R-CAR THERMAL DRIVERS19650RENESAS R-CAR THERMAL DRIVERS
19632M: Niklas Söderlund <niklas.soderlund@ragnatech.se>19651M: Niklas Söderlund <niklas.soderlund@ragnatech.se>
19633L: linux-renesas-soc@vger.kernel.org19652L: linux-renesas-soc@vger.kernel.org
@@ -19703,6 +19722,17 @@ S: Supported · 69 unmodified lines
19703F: Documentation/devicetree/bindings/i2c/renesas,rzv2m.yaml19722F: Documentation/devicetree/bindings/i2c/renesas,rzv2m.yaml
19704F: drivers/i2c/busses/i2c-rzv2m.c19723F: drivers/i2c/busses/i2c-rzv2m.c
19705 19724
19725RENESAS SUPERH ETHERNET DRIVER
19726M: Niklas Söderlund <niklas.soderlund@ragnatech.se>
19727L: netdev@vger.kernel.org
19728L: linux-renesas-soc@vger.kernel.org
19729S: Supported
19730F: Documentation/devicetree/bindings/net/renesas,ether.yaml
19731F: drivers/net/ethernet/renesas/Kconfig
19732F: drivers/net/ethernet/renesas/Makefile
19733F: drivers/net/ethernet/renesas/sh_eth*
19734F: include/linux/sh_eth.h
19735
19706RENESAS USB PHY DRIVER19736RENESAS USB PHY DRIVER
19707M: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>19737M: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
19708L: linux-renesas-soc@vger.kernel.org19738L: 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
3288 case INTEL_TLV_TEST_EXCEPTION:3288 case INTEL_TLV_TEST_EXCEPTION:
3289 /* Generate devcoredump from exception */3289 /* Generate devcoredump from exception */
3290 if (!hci_devcd_init(hdev, skb->len)) {3290 if (!hci_devcd_init(hdev, skb->len)) {
3291 hci_devcd_append(hdev, skb);3291 hci_devcd_append(hdev, skb_clone(skb, GFP_ATOMIC));
3292 hci_devcd_complete(hdev);3292 hci_devcd_complete(hdev);
3293 } else {3293 } else {
3294 bt_dev_err(hdev, "Failed to generate devcoredump");3294 bt_dev_err(hdev, "Failed to generate devcoredump");
3295 kfree_skb(skb);
3296 }3295 }
3297 return 0;3296 break;
3298 default:3297 default:
3299 bt_dev_err(hdev, "Invalid exception type %02X", tlv->val[0]);3298 bt_dev_err(hdev, "Invalid exception type %02X", tlv->val[0]);
3300 }3299 }
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
1008 1008
1009 if (bond->dev->flags & IFF_UP)1009 if (bond->dev->flags & IFF_UP)
1010 bond_hw_addr_flush(bond->dev, old_active->dev);1010 bond_hw_addr_flush(bond->dev, old_active->dev);
1011
1012 bond_slave_ns_maddrs_add(bond, old_active);
1011 }1013 }
1012 1014
1013 if (new_active) {1015 if (new_active) {
@@ -1024,6 +1026,8 @@ static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active, · 10 unmodified lines
1024 dev_mc_sync(new_active->dev, bond->dev);1026 dev_mc_sync(new_active->dev, bond->dev);
1025 netif_addr_unlock_bh(bond->dev);1027 netif_addr_unlock_bh(bond->dev);
1026 }1028 }
1029
1030 bond_slave_ns_maddrs_del(bond, new_active);
1027 }1031 }
1028}1032}
1029 1033
@@ -2341,6 +2345,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, · 1311 unmodified lines
2341 bond_compute_features(bond);2345 bond_compute_features(bond);
2342 bond_set_carrier(bond);2346 bond_set_carrier(bond);
2343 2347
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
2344 if (bond_uses_primary(bond)) {2353 if (bond_uses_primary(bond)) {
2345 block_netpoll_tx();2354 block_netpoll_tx();
2346 bond_select_active_slave(bond);2355 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
2350 if (bond_mode_can_use_xmit_hash(bond))2359 if (bond_mode_can_use_xmit_hash(bond))
2351 bond_update_slave_arr(bond, NULL);2360 bond_update_slave_arr(bond, NULL);
2352 2361
2353
2354 if (!slave_dev->netdev_ops->ndo_bpf ||2362 if (!slave_dev->netdev_ops->ndo_bpf ||
2355 !slave_dev->netdev_ops->ndo_xdp_xmit) {2363 !slave_dev->netdev_ops->ndo_xdp_xmit) {
2356 if (bond->xdp_prog) {2364 if (bond->xdp_prog) {
@@ -2548,6 +2556,12 @@ static int __bond_release_one(struct net_device *bond_dev, · 191 unmodified lines
2548 if (oldcurrent == slave)2556 if (oldcurrent == slave)
2549 bond_change_active_slave(bond, NULL);2557 bond_change_active_slave(bond, NULL);
2550 2558
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
2551 if (bond_is_lb(bond)) {2565 if (bond_is_lb(bond)) {
2552 /* Must be called only after the slave has been2566 /* Must be called only after the slave has been
2553 * detached from the list and the curr_active_slave2567 * detached from the list and the curr_active_slave
drivers/net/bonding/bond_options.c+81−1
@@ -15,6 +15,7 @@ · 14 unmodified lines
15#include <linux/sched/signal.h>15#include <linux/sched/signal.h>
16 16
17#include <net/bonding.h>17#include <net/bonding.h>
18#include <net/ndisc.h>
18 19
19static int bond_option_active_slave_set(struct bonding *bond,20static int bond_option_active_slave_set(struct bonding *bond,
20 const struct bond_opt_value *newval);21 const struct bond_opt_value *newval);
@@ -1234,6 +1235,68 @@ static int bond_option_arp_ip_targets_set(struct bonding *bond, · 1213 unmodified lines
1234}1235}
1235 1236
1236#if IS_ENABLED(CONFIG_IPV6)1237#if IS_ENABLED(CONFIG_IPV6)
1238static 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
1245static 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
1267void 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
1274void 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
1281static 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
1237static void _bond_options_ns_ip6_target_set(struct bonding *bond, int slot,1300static void _bond_options_ns_ip6_target_set(struct bonding *bond, int slot,
1238 struct in6_addr *target,1301 struct in6_addr *target,
1239 unsigned long last_rx)1302 unsigned long last_rx)
@@ -1243,8 +1306,10 @@ static void _bond_options_ns_ip6_target_set(struct bonding *bond, int slot, · 3 unmodified lines
1243 struct slave *slave;1306 struct slave *slave;
1244 1307
1245 if (slot >= 0 && slot < BOND_MAX_NS_TARGETS) {1308 if (slot >= 0 && slot < BOND_MAX_NS_TARGETS) {
1246 bond_for_each_slave(bond, slave, iter)1309 bond_for_each_slave(bond, slave, iter) {
1247 slave->target_last_arp_rx[slot] = last_rx;1310 slave->target_last_arp_rx[slot] = last_rx;
1311 slave_set_ns_maddr(bond, slave, target, &targets[slot]);
1312 }
1248 targets[slot] = *target;1313 targets[slot] = *target;
1249 }1314 }
1250}1315}
@@ -1296,15 +1361,30 @@ static int bond_option_ns_ip6_targets_set(struct bonding *bond, · 45 unmodified lines
1296{1361{
1297 return -EPERM;1362 return -EPERM;
1298}1363}
1364
1365static void slave_set_ns_maddrs(struct bonding *bond, struct slave *slave, bool add) {}
1366
1367void bond_slave_ns_maddrs_add(struct bonding *bond, struct slave *slave) {}
1368
1369void bond_slave_ns_maddrs_del(struct bonding *bond, struct slave *slave) {}
1299#endif1370#endif
1300 1371
1301static int bond_option_arp_validate_set(struct bonding *bond,1372static int bond_option_arp_validate_set(struct bonding *bond,
1302 const struct bond_opt_value *newval)1373 const struct bond_opt_value *newval)
1303{1374{
1375 bool changed = !!bond->params.arp_validate != !!newval->value;
1376 struct list_head *iter;
1377 struct slave *slave;
1378
1304 netdev_dbg(bond->dev, "Setting arp_validate to %s (%llu)\n",1379 netdev_dbg(bond->dev, "Setting arp_validate to %s (%llu)\n",
1305 newval->string, newval->value);1380 newval->string, newval->value);
1306 bond->params.arp_validate = newval->value;1381 bond->params.arp_validate = newval->value;
1307 1382
1383 if (changed) {
1384 bond_for_each_slave(bond, slave, iter)
1385 slave_set_ns_maddrs(bond, slave, !!bond->params.arp_validate);
1386 }
1387
1308 return 0;1388 return 0;
1309}1389}
1310 1390
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
907 int i, err = 0, vector = 0, free_vector = 0;907 int i, err = 0, vector = 0, free_vector = 0;
908 908
909 err = request_irq(adapter->msix_entries[vector].vector,909 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);
911 if (err)911 if (err)
912 goto err_out;912 goto err_out;
913 913
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
866 return 0;866 return 0;
867 867
868err_rule:868err_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);
870 mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id);870 mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id);
871err_mod_hdr:871err_mod_hdr:
872 kfree(attr);872 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
660 while (remaining > 0) {660 while (remaining > 0) {
661 skb_frag_t *frag = &record->frags[i];661 skb_frag_t *frag = &record->frags[i];
662 662
663 get_page(skb_frag_page(frag));663 page_ref_inc(skb_frag_page(frag));
664 remaining -= skb_frag_size(frag);664 remaining -= skb_frag_size(frag);
665 info->frags[i++] = *frag;665 info->frags[i++] = *frag;
666 }666 }
@@ -763,7 +763,7 @@ void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq, · 96 unmodified lines
763 stats = sq->stats;763 stats = sq->stats;
764 764
765 mlx5e_tx_dma_unmap(sq->pdev, dma);765 mlx5e_tx_dma_unmap(sq->pdev, dma);
766 put_page(wi->resync_dump_frag_page);766 page_ref_dec(wi->resync_dump_frag_page);
767 stats->tls_dump_packets++;767 stats->tls_dump_packets++;
768 stats->tls_dump_bytes += wi->num_bytes;768 stats->tls_dump_bytes += wi->num_bytes;
769}769}
@@ -816,12 +816,12 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, · 46 unmodified lines
816 816
817err_out:817err_out:
818 for (; i < info.nr_frags; i++)818 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().
820 * Page refs obtained for the DUMP WQEs above (by page_ref_add) will be820 * Page refs obtained for the DUMP WQEs above (by page_ref_add) will be
821 * released only upon their completions (or in mlx5e_free_txqsq_descs,821 * released only upon their completions (or in mlx5e_free_txqsq_descs,
822 * if channel closes).822 * if channel closes).
823 */823 */
824 put_page(skb_frag_page(&info.frags[i]));824 page_ref_dec(skb_frag_page(&info.frags[i]));
825 825
826 return MLX5E_KTLS_SYNC_FAIL;826 return MLX5E_KTLS_SYNC_FAIL;
827}827}
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
4267 struct mlx5e_params *params = &priv->channels.params;4267 struct mlx5e_params *params = &priv->channels.params;
4268 xdp_features_t val;4268 xdp_features_t val;
4269 4269
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) {
4271 xdp_clear_features_flag(netdev);4272 xdp_clear_features_flag(netdev);
4272 return;4273 return;
4273 }4274 }
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c+4−0
@@ -36,6 +36,7 @@ · 35 unmodified lines
36#include "en.h"36#include "en.h"
37#include "en/port.h"37#include "en/port.h"
38#include "eswitch.h"38#include "eswitch.h"
39#include "lib/mlx5.h"
39 40
40static int mlx5e_test_health_info(struct mlx5e_priv *priv)41static int mlx5e_test_health_info(struct mlx5e_priv *priv)
41{42{
@@ -247,6 +248,9 @@ static int mlx5e_cond_loopback(struct mlx5e_priv *priv) · 205 unmodified lines
247 if (is_mdev_switchdev_mode(priv->mdev))248 if (is_mdev_switchdev_mode(priv->mdev))
248 return -EOPNOTSUPP;249 return -EOPNOTSUPP;
249 250
251 if (mlx5_get_sd(priv->mdev))
252 return -EOPNOTSUPP;
253
250 return 0;254 return 0;
251}255}
252 256
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
2527 struct mlx5_eswitch_rep *rep, u8 rep_type)2527 struct mlx5_eswitch_rep *rep, u8 rep_type)
2528{2528{
2529 if (atomic_cmpxchg(&rep->rep_data[rep_type].state,2529 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);
2531 esw->offloads.rep_ops[rep_type]->unload(rep);2533 esw->offloads.rep_ops[rep_type]->unload(rep);
2534 }
2532}2535}
2533 2536
2534static void __unload_reps_all_vport(struct mlx5_eswitch *esw, u8 rep_type)2537static 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
2105 fte_tmp = NULL;2105 fte_tmp = NULL;
2106 goto out;2106 goto out;
2107 }2107 }
2108
2109 nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
2110
2108 if (!fte_tmp->node.active) {2111 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
2109 tree_put_node(&fte_tmp->node, false);2119 tree_put_node(&fte_tmp->node, false);
2110 fte_tmp = NULL;2120
2111 goto out;2121 return NULL;
2112 }2122 }
2113 2123
2114 nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
2115out:2124out:
2116 if (take_write)2125 if (take_write)
2117 up_write_ref_node(&g->node, false);2126 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
593 kvfree(pool);593 kvfree(pool);
594}594}
595 595
596static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec)596static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec,
597 bool dynamic_vec)
597{598{
598 struct mlx5_irq_table *table = dev->priv.irq_table;599 struct mlx5_irq_table *table = dev->priv.irq_table;
600 int sf_vec_available = sf_vec;
599 int num_sf_ctrl;601 int num_sf_ctrl;
600 int err;602 int err;
601 603
@@ -616,6 +618,13 @@ static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec) · 14 unmodified lines
616 num_sf_ctrl = DIV_ROUND_UP(mlx5_sf_max_functions(dev),618 num_sf_ctrl = DIV_ROUND_UP(mlx5_sf_max_functions(dev),
617 MLX5_SFS_PER_CTRL_IRQ);619 MLX5_SFS_PER_CTRL_IRQ);
618 num_sf_ctrl = min_t(int, MLX5_IRQ_CTRL_SF_MAX, num_sf_ctrl);620 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
619 table->sf_ctrl_pool = irq_pool_alloc(dev, pcif_vec, num_sf_ctrl,628 table->sf_ctrl_pool = irq_pool_alloc(dev, pcif_vec, num_sf_ctrl,
620 "mlx5_sf_ctrl",629 "mlx5_sf_ctrl",
621 MLX5_EQ_SHARE_IRQ_MIN_CTRL,630 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
624 err = PTR_ERR(table->sf_ctrl_pool);633 err = PTR_ERR(table->sf_ctrl_pool);
625 goto err_pf;634 goto err_pf;
626 }635 }
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 */
628 table->sf_comp_pool = irq_pool_alloc(dev, pcif_vec + num_sf_ctrl,639 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",
630 MLX5_EQ_SHARE_IRQ_MIN_COMP,641 MLX5_EQ_SHARE_IRQ_MIN_COMP,
631 MLX5_EQ_SHARE_IRQ_MAX_COMP);642 MLX5_EQ_SHARE_IRQ_MAX_COMP);
632 if (IS_ERR(table->sf_comp_pool)) {643 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
715int mlx5_irq_table_create(struct mlx5_core_dev *dev)726int mlx5_irq_table_create(struct mlx5_core_dev *dev)
716{727{
717 int num_eqs = mlx5_max_eq_cap_get(dev);728 int num_eqs = mlx5_max_eq_cap_get(dev);
729 bool dynamic_vec;
718 int total_vec;730 int total_vec;
719 int pcif_vec;731 int pcif_vec;
720 int req_vec;732 int req_vec;
@@ -724,21 +736,31 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev) · 3 unmodified lines
724 if (mlx5_core_is_sf(dev))736 if (mlx5_core_is_sf(dev))
725 return 0;737 return 0;
726 738
739 /* PCI PF vectors usage is limited by online cpus, device EQs and
740 * PCI MSI-X capability.
741 */
727 pcif_vec = MLX5_CAP_GEN(dev, num_ports) * num_online_cpus() + 1;742 pcif_vec = MLX5_CAP_GEN(dev, num_ports) * num_online_cpus() + 1;
728 pcif_vec = min_t(int, pcif_vec, num_eqs);743 pcif_vec = min_t(int, pcif_vec, num_eqs);
744 pcif_vec = min_t(int, pcif_vec, pci_msix_vec_count(dev->pdev));
729 745
730 total_vec = pcif_vec;746 total_vec = pcif_vec;
731 if (mlx5_sf_max_functions(dev))747 if (mlx5_sf_max_functions(dev))
732 total_vec += MLX5_MAX_MSIX_PER_SF * mlx5_sf_max_functions(dev);748 total_vec += MLX5_MAX_MSIX_PER_SF * mlx5_sf_max_functions(dev);
733 total_vec = min_t(int, total_vec, pci_msix_vec_count(dev->pdev));749 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));
735 750
736 req_vec = pci_msix_can_alloc_dyn(dev->pdev) ? 1 : total_vec;751 req_vec = pci_msix_can_alloc_dyn(dev->pdev) ? 1 : total_vec;
737 n = pci_alloc_irq_vectors(dev->pdev, 1, req_vec, PCI_IRQ_MSIX);752 n = pci_alloc_irq_vectors(dev->pdev, 1, req_vec, PCI_IRQ_MSIX);
738 if (n < 0)753 if (n < 0)
739 return n;754 return n;
740 755
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);
742 if (err)764 if (err)
743 pci_free_irq_vectors(dev->pdev);765 pci_free_irq_vectors(dev->pdev);
744 766
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
108 if (IS_ERR(dwmac->tx_clk))108 if (IS_ERR(dwmac->tx_clk))
109 return PTR_ERR(dwmac->tx_clk);109 return PTR_ERR(dwmac->tx_clk);
110 110
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 }
112 117
113 /* Check and configure TX clock rate */118 /* Check and configure TX clock rate */
114 rate = clk_get_rate(dwmac->tx_clk);119 rate = clk_get_rate(dwmac->tx_clk);
@@ -119,7 +124,7 @@ static int intel_eth_plat_probe(struct platform_device *pdev) · 4 unmodified lines
119 if (ret) {124 if (ret) {
120 dev_err(&pdev->dev,125 dev_err(&pdev->dev,
121 "Failed to set tx_clk\n");126 "Failed to set tx_clk\n");
122 return ret;127 goto err_tx_clk_disable;
123 }128 }
124 }129 }
125 }130 }
@@ -133,7 +138,7 @@ static int intel_eth_plat_probe(struct platform_device *pdev) · 7 unmodified lines
133 if (ret) {138 if (ret) {
134 dev_err(&pdev->dev,139 dev_err(&pdev->dev,
135 "Failed to set clk_ptp_ref\n");140 "Failed to set clk_ptp_ref\n");
136 return ret;141 goto err_tx_clk_disable;
137 }142 }
138 }143 }
139 }144 }
@@ -149,12 +154,15 @@ static int intel_eth_plat_probe(struct platform_device *pdev) · 9 unmodified lines
149 }154 }
150 155
151 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);156 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
152 if (ret) {157 if (ret)
153 clk_disable_unprepare(dwmac->tx_clk);158 goto err_tx_clk_disable;
154 return ret;
155 }
156 159
157 return 0;160 return 0;
161
162err_tx_clk_disable:
163 if (dwmac->data->tx_clk_en)
164 clk_disable_unprepare(dwmac->tx_clk);
165 return ret;
158}166}
159 167
160static void intel_eth_plat_remove(struct platform_device *pdev)168static 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
162 struct intel_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);170 struct intel_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);
163 171
164 stmmac_pltfr_remove(pdev);172 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);
166}175}
167 176
168static struct platform_driver intel_eth_plat_driver = {177static 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
589 589
590 plat->mac_interface = priv_plat->phy_mode;590 plat->mac_interface = priv_plat->phy_mode;
591 if (priv_plat->mac_wol)591 if (priv_plat->mac_wol)
592 plat->flags |= STMMAC_FLAG_USE_PHY_WOL;
593 else
594 plat->flags &= ~STMMAC_FLAG_USE_PHY_WOL;592 plat->flags &= ~STMMAC_FLAG_USE_PHY_WOL;
593 else
594 plat->flags |= STMMAC_FLAG_USE_PHY_WOL;
595 plat->riwt_off = 1;595 plat->riwt_off = 1;
596 plat->maxmtu = ETH_DATA_LEN;596 plat->maxmtu = ETH_DATA_LEN;
597 plat->host_dma_width = priv_plat->variant->dma_bit_mask;597 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
16#include <linux/if_hsr.h>16#include <linux/if_hsr.h>
17#include <linux/if_vlan.h>17#include <linux/if_vlan.h>
18#include <linux/interrupt.h>18#include <linux/interrupt.h>
19#include <linux/io-64-nonatomic-hi-lo.h>
19#include <linux/kernel.h>20#include <linux/kernel.h>
20#include <linux/mfd/syscon.h>21#include <linux/mfd/syscon.h>
21#include <linux/module.h>22#include <linux/module.h>
@@ -411,6 +412,8 @@ static int prueth_perout_enable(void *clockops_data, · 389 unmodified lines
411 struct prueth_emac *emac = clockops_data;412 struct prueth_emac *emac = clockops_data;
412 u32 reduction_factor = 0, offset = 0;413 u32 reduction_factor = 0, offset = 0;
413 struct timespec64 ts;414 struct timespec64 ts;
415 u64 current_cycle;
416 u64 start_offset;
414 u64 ns_period;417 u64 ns_period;
415 418
416 if (!on)419 if (!on)
@@ -449,8 +452,14 @@ static int prueth_perout_enable(void *clockops_data, · 32 unmodified lines
449 writel(reduction_factor, emac->prueth->shram.va +452 writel(reduction_factor, emac->prueth->shram.va +
450 TIMESYNC_FW_WC_SYNCOUT_REDUCTION_FACTOR_OFFSET);453 TIMESYNC_FW_WC_SYNCOUT_REDUCTION_FACTOR_OFFSET);
451 454
452 writel(0, emac->prueth->shram.va +455 current_cycle = icssg_read_time(emac->prueth->shram.va +
453 TIMESYNC_FW_WC_SYNCOUT_START_TIME_CYCLECOUNT_OFFSET);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);
454 463
455 return 0;464 return 0;
456}465}
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
330extern const struct ethtool_ops icssg_ethtool_ops;330extern const struct ethtool_ops icssg_ethtool_ops;
331extern const struct dev_pm_ops prueth_dev_pm_ops;331extern const struct dev_pm_ops prueth_dev_pm_ops;
332 332
333static 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
333/* Classifier helpers */345/* Classifier helpers */
334void icssg_class_set_mac_addr(struct regmap *miig_rt, int slice, u8 *mac);346void icssg_class_set_mac_addr(struct regmap *miig_rt, int slice, u8 *mac);
335void icssg_class_set_host_mac_addr(struct regmap *miig_rt, const u8 *mac);347void 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
437 mse = &mses->mse102x;437 mse = &mses->mse102x;
438 438
439 while ((txb = skb_dequeue(&mse->txq))) {439 while ((txb = skb_dequeue(&mse->txq))) {
440 unsigned int len = max_t(unsigned int, txb->len, ETH_ZLEN);
441
440 mutex_lock(&mses->lock);442 mutex_lock(&mses->lock);
441 ret = mse102x_tx_pkt_spi(mse, txb, work_timeout);443 ret = mse102x_tx_pkt_spi(mse, txb, work_timeout);
442 mutex_unlock(&mses->lock);444 mutex_unlock(&mses->lock);
443 if (ret) {445 if (ret) {
444 mse->ndev->stats.tx_dropped++;446 mse->ndev->stats.tx_dropped++;
445 } else {447 } else {
446 mse->ndev->stats.tx_bytes += txb->len;448 mse->ndev->stats.tx_bytes += len;
447 mse->ndev->stats.tx_packets++;449 mse->ndev->stats.tx_packets++;
448 }450 }
449 451
drivers/net/phy/phylink.c+8−6
@@ -78,7 +78,7 @@ struct phylink { · 77 unmodified lines
78 unsigned int pcs_neg_mode;78 unsigned int pcs_neg_mode;
79 unsigned int pcs_state;79 unsigned int pcs_state;
80 80
81 bool mac_link_dropped;81 bool link_failed;
82 bool using_mac_select_pcs;82 bool using_mac_select_pcs;
83 83
84 struct sfp_bus *sfp_bus;84 struct sfp_bus *sfp_bus;
@@ -1475,9 +1475,9 @@ static void phylink_resolve(struct work_struct *w) · 1390 unmodified lines
1475 cur_link_state = pl->old_link_state;1475 cur_link_state = pl->old_link_state;
1476 1476
1477 if (pl->phylink_disable_state) {1477 if (pl->phylink_disable_state) {
1478 pl->mac_link_dropped = false;1478 pl->link_failed = false;
1479 link_state.link = false;1479 link_state.link = false;
1480 } else if (pl->mac_link_dropped) {1480 } else if (pl->link_failed) {
1481 link_state.link = false;1481 link_state.link = false;
1482 retrigger = true;1482 retrigger = true;
1483 } else {1483 } else {
@@ -1572,7 +1572,7 @@ static void phylink_resolve(struct work_struct *w) · 88 unmodified lines
1572 phylink_link_up(pl, link_state);1572 phylink_link_up(pl, link_state);
1573 }1573 }
1574 if (!link_state.link && retrigger) {1574 if (!link_state.link && retrigger) {
1575 pl->mac_link_dropped = false;1575 pl->link_failed = false;
1576 queue_work(system_power_efficient_wq, &pl->resolve);1576 queue_work(system_power_efficient_wq, &pl->resolve);
1577 }1577 }
1578 mutex_unlock(&pl->state_mutex);1578 mutex_unlock(&pl->state_mutex);
@@ -1835,6 +1835,8 @@ static void phylink_phy_change(struct phy_device *phydev, bool up) · 256 unmodified lines
1835 pl->phy_state.pause |= MLO_PAUSE_RX;1835 pl->phy_state.pause |= MLO_PAUSE_RX;
1836 pl->phy_state.interface = phydev->interface;1836 pl->phy_state.interface = phydev->interface;
1837 pl->phy_state.link = up;1837 pl->phy_state.link = up;
1838 if (!up)
1839 pl->link_failed = true;
1838 mutex_unlock(&pl->state_mutex);1840 mutex_unlock(&pl->state_mutex);
1839 1841
1840 phylink_run_resolve(pl);1842 phylink_run_resolve(pl);
@@ -2158,7 +2160,7 @@ EXPORT_SYMBOL_GPL(phylink_disconnect_phy); · 317 unmodified lines
2158static void phylink_link_changed(struct phylink *pl, bool up, const char *what)2160static void phylink_link_changed(struct phylink *pl, bool up, const char *what)
2159{2161{
2160 if (!up)2162 if (!up)
2161 pl->mac_link_dropped = true;2163 pl->link_failed = true;
2162 phylink_run_resolve(pl);2164 phylink_run_resolve(pl);
2163 phylink_dbg(pl, "%s link %s\n", what, up ? "up" : "down");2165 phylink_dbg(pl, "%s link %s\n", what, up ? "up" : "down");
2164}2166}
@@ -2792,7 +2794,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl, · 627 unmodified lines
2792 * link will cycle.2794 * link will cycle.
2793 */2795 */
2794 if (manual_changed) {2796 if (manual_changed) {
2795 pl->mac_link_dropped = true;2797 pl->link_failed = true;
2796 phylink_run_resolve(pl);2798 phylink_run_resolve(pl);
2797 }2799 }
2798 2800
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
77{77{
78 if (optlen < ksize)78 if (optlen < ksize)
79 return -EINVAL;79 return -EINVAL;
80 return copy_from_sockptr(dst, optval, ksize);80 if (copy_from_sockptr(dst, optval, ksize))
81 return -EFAULT;
82 return 0;
81}83}
82 84
83static inline int copy_struct_from_sockptr(void *dst, size_t ksize,85static 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
161#if IS_ENABLED(CONFIG_IPV6)161#if IS_ENABLED(CONFIG_IPV6)
162void bond_option_ns_ip6_targets_clear(struct bonding *bond);162void bond_option_ns_ip6_targets_clear(struct bonding *bond);
163#endif163#endif
164void bond_slave_ns_maddrs_add(struct bonding *bond, struct slave *slave);
165void bond_slave_ns_maddrs_del(struct bonding *bond, struct slave *slave);
164 166
165#endif /* _NET_BOND_OPTIONS_H */167#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
3788 3788
3789 hci_dev_lock(hdev);3789 hci_dev_lock(hdev);
3790 conn = hci_conn_hash_lookup_handle(hdev, handle);3790 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);
3793 hci_dev_unlock(hdev);3791 hci_dev_unlock(hdev);
3794 3792
3795 if (conn) {3793 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
1052 1052
1053#ifdef CONFIG_PAGE_POOL1053#ifdef CONFIG_PAGE_POOL
1054 1054
1055/* This is the number of tokens that the user can SO_DEVMEM_DONTNEED in1055/* This is the number of tokens and frags that the user can SO_DEVMEM_DONTNEED
1056 * 1 syscall. The limit exists to limit the amount of memory the kernel1056 * in 1 syscall. The limit exists to limit the amount of memory the kernel
1057 * allocates to copy these tokens.1057 * allocates to copy these tokens, and to prevent looping over the frags for
1058 * too long.
1058 */1059 */
1059#define MAX_DONTNEED_TOKENS 1281060#define MAX_DONTNEED_TOKENS 128
1061#define MAX_DONTNEED_FRAGS 1024
1060 1062
1061static noinline_for_stack int1063static noinline_for_stack int
1062sock_devmem_dontneed(struct sock *sk, sockptr_t optval, unsigned int optlen)1064sock_devmem_dontneed(struct sock *sk, sockptr_t optval, unsigned int optlen)
1063{1065{
1064 unsigned int num_tokens, i, j, k, netmem_num = 0;1066 unsigned int num_tokens, i, j, k, netmem_num = 0;
1065 struct dmabuf_token *tokens;1067 struct dmabuf_token *tokens;
1068 int ret = 0, num_frags = 0;
1066 netmem_ref netmems[16];1069 netmem_ref netmems[16];
1067 int ret = 0;
1068 1070
1069 if (!sk_is_tcp(sk))1071 if (!sk_is_tcp(sk))
1070 return -EBADF;1072 return -EBADF;
1071 1073
1072 if (optlen % sizeof(struct dmabuf_token) ||1074 if (optlen % sizeof(*tokens) ||
1073 optlen > sizeof(*tokens) * MAX_DONTNEED_TOKENS)1075 optlen > sizeof(*tokens) * MAX_DONTNEED_TOKENS)
1074 return -EINVAL;1076 return -EINVAL;
1075 1077
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);
1077 if (!tokens)1080 if (!tokens)
1078 return -ENOMEM;1081 return -ENOMEM;
1079 1082
1080 num_tokens = optlen / sizeof(struct dmabuf_token);
1081 if (copy_from_sockptr(tokens, optval, optlen)) {1083 if (copy_from_sockptr(tokens, optval, optlen)) {
1082 kvfree(tokens);1084 kvfree(tokens);
1083 return -EFAULT;1085 return -EFAULT;
@@ -1086,24 +1088,28 @@ sock_devmem_dontneed(struct sock *sk, sockptr_t optval, unsigned int optlen) · 2 unmodified lines
1086 xa_lock_bh(&sk->sk_user_frags);1088 xa_lock_bh(&sk->sk_user_frags);
1087 for (i = 0; i < num_tokens; i++) {1089 for (i = 0; i < num_tokens; i++) {
1088 for (j = 0; j < tokens[i].token_count; j++) {1090 for (j = 0; j < tokens[i].token_count; j++) {
1091 if (++num_frags > MAX_DONTNEED_FRAGS)
1092 goto frag_limit_reached;
1093
1089 netmem_ref netmem = (__force netmem_ref)__xa_erase(1094 netmem_ref netmem = (__force netmem_ref)__xa_erase(
1090 &sk->sk_user_frags, tokens[i].token_start + j);1095 &sk->sk_user_frags, tokens[i].token_start + j);
1091 1096
1092 if (netmem &&1097 if (!netmem || WARN_ON_ONCE(!netmem_is_net_iov(netmem)))
1093 !WARN_ON_ONCE(!netmem_is_net_iov(netmem))) {1098 continue;
1094 netmems[netmem_num++] = netmem;1099
1095 if (netmem_num == ARRAY_SIZE(netmems)) {1100 netmems[netmem_num++] = netmem;
1096 xa_unlock_bh(&sk->sk_user_frags);1101 if (netmem_num == ARRAY_SIZE(netmems)) {
1097 for (k = 0; k < netmem_num; k++)1102 xa_unlock_bh(&sk->sk_user_frags);
1098 WARN_ON_ONCE(!napi_pp_put_page(netmems[k]));1103 for (k = 0; k < netmem_num; k++)
1099 netmem_num = 0;1104 WARN_ON_ONCE(!napi_pp_put_page(netmems[k]));
1100 xa_lock_bh(&sk->sk_user_frags);1105 netmem_num = 0;
1101 }1106 xa_lock_bh(&sk->sk_user_frags);
1102 ret++;
1103 }1107 }
1108 ret++;
1104 }1109 }
1105 }1110 }
1106 1111
1112frag_limit_reached:
1107 xa_unlock_bh(&sk->sk_user_frags);1113 xa_unlock_bh(&sk->sk_user_frags);
1108 for (k = 0; k < netmem_num; k++)1114 for (k = 0; k < netmem_num; k++)
1109 WARN_ON_ONCE(!napi_pp_put_page(netmems[k]));1115 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
618 by tcp. Feel free to propose better solution.618 by tcp. Feel free to propose better solution.
619 --ANK (980728)619 --ANK (980728)
620 */620 */
621 if (np->rxopt.all)621 if (np->rxopt.all && sk->sk_state != DCCP_LISTEN)
622 opt_skb = skb_clone_and_charge_r(skb, sk);622 opt_skb = skb_clone_and_charge_r(skb, sk);
623 623
624 if (sk->sk_state == DCCP_OPEN) { /* Fast path */624 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
310 if (filter->filter_set)310 if (filter->filter_set)
311 flags |= NLM_F_DUMP_FILTERED;311 flags |= NLM_F_DUMP_FILTERED;
312 312
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()) {
314 if (e < s_e)315 if (e < s_e)
315 goto next_entry;316 goto next_entry;
316 if (filter->dev &&317 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
1618 by tcp. Feel free to propose better solution.1618 by tcp. Feel free to propose better solution.
1619 --ANK (980728)1619 --ANK (980728)
1620 */1620 */
1621 if (np->rxopt.all)1621 if (np->rxopt.all && sk->sk_state != TCP_LISTEN)
1622 opt_skb = skb_clone_and_charge_r(skb, sk);1622 opt_skb = skb_clone_and_charge_r(skb, sk);
1623 1623
1624 if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */1624 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
1656 if (reason)1656 if (reason)
1657 goto reset;1657 goto reset;
1658 }1658 }
1659 if (opt_skb)
1660 __kfree_skb(opt_skb);
1661 return 0;1659 return 0;
1662 }1660 }
1663 } else1661 } 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
524{524{
525 struct mptcp_pm_addr_entry *entry;525 struct mptcp_pm_addr_entry *entry;
526 526
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)) {
528 if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port))529 if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port))
529 return entry;530 return entry;
530 }531 }
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
308 308
309 lock_sock(sk);309 lock_sock(sk);
310 310
311 spin_lock_bh(&msk->pm.lock);
311 match = mptcp_userspace_pm_lookup_addr_by_id(msk, id_val);312 match = mptcp_userspace_pm_lookup_addr_by_id(msk, id_val);
312 if (!match) {313 if (!match) {
313 GENL_SET_ERR_MSG(info, "address with specified id not found");314 GENL_SET_ERR_MSG(info, "address with specified id not found");
315 spin_unlock_bh(&msk->pm.lock);
314 release_sock(sk);316 release_sock(sk);
315 goto out;317 goto out;
316 }318 }
317 319
318 list_move(&match->list, &free_list);320 list_move(&match->list, &free_list);
321 spin_unlock_bh(&msk->pm.lock);
319 322
320 mptcp_pm_remove_addrs(msk, &free_list);323 mptcp_pm_remove_addrs(msk, &free_list);
321 324
@@ -560,6 +563,7 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info) · 238 unmodified lines
560 struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];563 struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];
561 struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR];564 struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR];
562 struct net *net = sock_net(skb->sk);565 struct net *net = sock_net(skb->sk);
566 struct mptcp_pm_addr_entry *entry;
563 struct mptcp_sock *msk;567 struct mptcp_sock *msk;
564 int ret = -EINVAL;568 int ret = -EINVAL;
565 struct sock *sk;569 struct sock *sk;
@@ -601,6 +605,17 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info) · 35 unmodified lines
601 if (loc.flags & MPTCP_PM_ADDR_FLAG_BACKUP)605 if (loc.flags & MPTCP_PM_ADDR_FLAG_BACKUP)
602 bkup = 1;606 bkup = 1;
603 607
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
604 lock_sock(sk);619 lock_sock(sk);
605 ret = mptcp_pm_nl_mp_prio_send_ack(msk, &loc.addr, &rem.addr, bkup);620 ret = mptcp_pm_nl_mp_prio_send_ack(msk, &loc.addr, &rem.addr, bkup);
606 release_sock(sk);621 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
2082 slow = lock_sock_fast(ssk);2082 slow = lock_sock_fast(ssk);
2083 WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf);2083 WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf);
2084 WRITE_ONCE(tcp_sk(ssk)->window_clamp, window_clamp);2084 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);
2086 unlock_sock_fast(ssk, slow);2087 unlock_sock_fast(ssk, slow);
2087 }2088 }
2088 }2089 }
@@ -2205,7 +2206,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, · 116 unmodified lines
2205 cmsg_flags = MPTCP_CMSG_INQ;2206 cmsg_flags = MPTCP_CMSG_INQ;
2206 2207
2207 while (copied < len) {2208 while (copied < len) {
2208 int bytes_read;2209 int err, bytes_read;
2209 2210
2210 bytes_read = __mptcp_recvmsg_mskq(msk, msg, len - copied, flags, &tss, &cmsg_flags);2211 bytes_read = __mptcp_recvmsg_mskq(msk, msg, len - copied, flags, &tss, &cmsg_flags);
2211 if (unlikely(bytes_read < 0)) {2212 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
2267 }2268 }
2268 2269
2269 pr_debug("block timeout %ld\n", timeo);2270 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 }
2271 }2277 }
2272 2278
2279 mptcp_rcv_space_adjust(msk, copied);
2280
2273out_err:2281out_err:
2274 if (cmsg_flags && copied >= 0) {2282 if (cmsg_flags && copied >= 0) {
2275 if (cmsg_flags & MPTCP_CMSG_TS)2283 if (cmsg_flags & MPTCP_CMSG_TS)
@@ -2285,8 +2293,6 @@ out_err: · 9 unmodified lines
2285 pr_debug("msk=%p rx queue empty=%d:%d copied=%d\n",2293 pr_debug("msk=%p rx queue empty=%d:%d copied=%d\n",
2286 msk, skb_queue_empty_lockless(&sk->sk_receive_queue),2294 msk, skb_queue_empty_lockless(&sk->sk_receive_queue),
2287 skb_queue_empty(&msk->receive_queue), copied);2295 skb_queue_empty(&msk->receive_queue), copied);
2288 if (!(flags & MSG_PEEK))
2289 mptcp_rcv_space_adjust(msk, copied);
2290 2296
2291 release_sock(sk);2297 release_sock(sk);
2292 return copied;2298 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
393 393
394static void netlink_sock_destruct(struct sock *sk)394static void netlink_sock_destruct(struct sock *sk)
395{395{
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
405 skb_queue_purge(&sk->sk_receive_queue);396 skb_queue_purge(&sk->sk_receive_queue);
406 397
407 if (!sock_flag(sk, SOCK_DEAD)) {398 if (!sock_flag(sk, SOCK_DEAD)) {
@@ -414,14 +405,6 @@ static void netlink_sock_destruct(struct sock *sk) · 6 unmodified lines
414 WARN_ON(nlk_sk(sk)->groups);405 WARN_ON(nlk_sk(sk)->groups);
415}406}
416 407
417static 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
425/* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on408/* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on
426 * SMP. Look, when several writers sleep and reader wakes them up, all but one409 * SMP. Look, when several writers sleep and reader wakes them up, all but one
427 * immediately hit write lock and grab all the cpus. Exclusive sleep solves410 * 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
731 if (!refcount_dec_and_test(&sk->sk_refcnt))714 if (!refcount_dec_and_test(&sk->sk_refcnt))
732 return;715 return;
733 716
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
740 sk_free(sk);717 sk_free(sk);
741}718}
742 719
@@ -788,6 +765,14 @@ static int netlink_release(struct socket *sock) · 45 unmodified lines
788 NETLINK_URELEASE, &n);765 NETLINK_URELEASE, &n);
789 }766 }
790 767
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
791 module_put(nlk->module);776 module_put(nlk->module);
792 777
793 if (netlink_is_kernel(sk)) {778 if (netlink_is_kernel(sk)) {
net/netlink/af_netlink.h+0−2
@@ -4,7 +4,6 @@ · 3 unmodified lines
4 4
5#include <linux/rhashtable.h>5#include <linux/rhashtable.h>
6#include <linux/atomic.h>6#include <linux/atomic.h>
7#include <linux/workqueue.h>
8#include <net/sock.h>7#include <net/sock.h>
9 8
10/* flags */9/* flags */
@@ -50,7 +49,6 @@ struct netlink_sock { · 39 unmodified lines
50 49
51 struct rhash_head node;50 struct rhash_head node;
52 struct rcu_head rcu;51 struct rcu_head rcu;
53 struct work_struct work;
54};52};
55 53
56static inline struct netlink_sock *nlk_sk(struct sock *sk)54static 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
92 long knodes;92 long knodes;
93};93};
94 94
95static u32 handle2id(u32 h)
96{
97 return ((h & 0x80000000) ? ((h >> 20) & 0x7FF) : h);
98}
99
100static u32 id2handle(u32 id)
101{
102 return (id | 0x800U) << 20;
103}
104
95static inline unsigned int u32_hash_fold(__be32 key,105static inline unsigned int u32_hash_fold(__be32 key,
96 const struct tc_u32_sel *sel,106 const struct tc_u32_sel *sel,
97 u8 fshift)107 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
310 int id = idr_alloc_cyclic(&tp_c->handle_idr, ptr, 1, 0x7FF, GFP_KERNEL);320 int id = idr_alloc_cyclic(&tp_c->handle_idr, ptr, 1, 0x7FF, GFP_KERNEL);
311 if (id < 0)321 if (id < 0)
312 return 0;322 return 0;
313 return (id | 0x800U) << 20;323 return id2handle(id);
314}324}
315 325
316static struct hlist_head *tc_u_common_hash;326static struct hlist_head *tc_u_common_hash;
@@ -360,7 +370,7 @@ static int u32_init(struct tcf_proto *tp) · 43 unmodified lines
360 return -ENOBUFS;370 return -ENOBUFS;
361 371
362 refcount_set(&root_ht->refcnt, 1);372 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);
364 root_ht->prio = tp->prio;374 root_ht->prio = tp->prio;
365 root_ht->is_root = true;375 root_ht->is_root = true;
366 idr_init(&root_ht->handle_idr);376 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
612 if (phn == ht) {622 if (phn == ht) {
613 u32_clear_hw_hnode(tp, ht, extack);623 u32_clear_hw_hnode(tp, ht, extack);
614 idr_destroy(&ht->handle_idr);624 idr_destroy(&ht->handle_idr);
615 idr_remove(&tp_c->handle_idr, ht->handle);625 idr_remove(&tp_c->handle_idr, handle2id(ht->handle));
616 RCU_INIT_POINTER(*hn, ht->next);626 RCU_INIT_POINTER(*hn, ht->next);
617 kfree_rcu(ht, rcu);627 kfree_rcu(ht, rcu);
618 return 0;628 return 0;
@@ -989,7 +999,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, · 370 unmodified lines
989 999
990 err = u32_replace_hw_hnode(tp, ht, userflags, extack);1000 err = u32_replace_hw_hnode(tp, ht, userflags, extack);
991 if (err) {1001 if (err) {
992 idr_remove(&tp_c->handle_idr, handle);1002 idr_remove(&tp_c->handle_idr, handle2id(handle));
993 kfree(ht);1003 kfree(ht);
994 return err;1004 return err;
995 }1005 }
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
683 struct sock *sk = &sp->inet.sk;683 struct sock *sk = &sp->inet.sk;
684 struct net *net = sock_net(sk);684 struct net *net = sock_net(sk);
685 struct net_device *dev = NULL;685 struct net_device *dev = NULL;
686 int type;686 int type, res, bound_dev_if;
687 687
688 type = ipv6_addr_type(in6);688 type = ipv6_addr_type(in6);
689 if (IPV6_ADDR_ANY == type)689 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
697 if (!(type & IPV6_ADDR_UNICAST))697 if (!(type & IPV6_ADDR_UNICAST))
698 return 0;698 return 0;
699 699
700 if (sk->sk_bound_dev_if) {700 rcu_read_lock();
701 dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);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);
702 if (!dev)705 if (!dev)
703 return 0;706 goto out;
704 }707 }
705 708
706 return ipv6_can_nonlocal_bind(net, &sp->inet) ||709 res = ipv6_can_nonlocal_bind(net, &sp->inet) ||
707 ipv6_chk_addr(net, in6, dev, 0);710 ipv6_chk_addr(net, in6, dev, 0);
711
712out:
713 rcu_read_unlock();
714 return res;
708}715}
709 716
710/* This function checks if the address is a valid address to be used for717/* 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
836{836{
837 struct vsock_sock *vsk = vsock_sk(sk);837 struct vsock_sock *vsk = vsock_sk(sk);
838 838
839 /* Flush MSG_ZEROCOPY leftovers. */
840 __skb_queue_purge(&sk->sk_error_queue);
841
839 vsock_deassign_transport(vsk);842 vsock_deassign_transport(vsk);
840 843
841 /* When clearing these addresses, there's no need to set the family and844 /* 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
400 if (virtio_transport_init_zcopy_skb(vsk, skb,400 if (virtio_transport_init_zcopy_skb(vsk, skb,
401 info->msg,401 info->msg,
402 can_zcopy)) {402 can_zcopy)) {
403 kfree_skb(skb);
403 ret = -ENOMEM;404 ret = -ENOMEM;
404 break;405 break;
405 }406 }
@@ -1513,6 +1514,14 @@ virtio_transport_recv_listen(struct sock *sk, struct sk_buff *skb, · 1107 unmodified lines
1513 return -ENOMEM;1514 return -ENOMEM;
1514 }1515 }
1515 1516
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
1516 child = vsock_create_connected(sk);1525 child = vsock_create_connected(sk);
1517 if (!child) {1526 if (!child) {
1518 virtio_transport_reset_no_sock(t, skb);1527 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
76 pg_set $DEV "udp_dst_max $UDP_DST_MAX"76 pg_set $DEV "udp_dst_max $UDP_DST_MAX"
77fi77fi
78 78
79[ ! -z "$UDP_CSUM" ] && pg_set $dev "flag UDPCSUM"79[ ! -z "$UDP_CSUM" ] && pg_set $DEV "flag UDPCSUM"
80 80
81# Setup random UDP port src range81# Setup random UDP port src range
82pg_set $DEV "flag UDPSRC_RND"82pg_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
11 11
12lib_dir=$(dirname "$0")12lib_dir=$(dirname "$0")
13source ${lib_dir}/bond_topo_3d1c.sh13source ${lib_dir}/bond_topo_3d1c.sh
14c_maddr="33:33:00:00:00:10"
15g_maddr="33:33:00:00:02:54"
14 16
15skip_prio()17skip_prio()
16{18{
@@ -240,6 +242,54 @@ arp_validate_test() · 223 unmodified lines
240 done242 done
241}243}
242 244
245# Testing correct multicast groups are added to slaves for ns targets
246arp_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
243arp_validate_arp()293arp_validate_arp()
244{294{
245 local mode=$1295 local mode=$1
@@ -261,8 +311,10 @@ arp_validate_ns() · 15 unmodified lines
261 fi311 fi
262 312
263 for val in $(seq 0 6); do313 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"
265 log_test "arp_validate" "$mode ns_ip6_target arp_validate $val"315 log_test "arp_validate" "$mode ns_ip6_target arp_validate $val"
316 arp_validate_mcast
317 log_test "arp_validate" "join mcast group"
266 done318 done
267}319}
268 320
tools/testing/selftests/net/.gitignore+1−0
@@ -19,6 +19,7 @@ log.txt · 18 unmodified lines
19msg_oob19msg_oob
20msg_zerocopy20msg_zerocopy
21ncdevmem21ncdevmem
22netlink-dumps
22nettest23nettest
23psock_fanout24psock_fanout
24psock_snd25psock_snd
tools/testing/selftests/net/Makefile+1−0
@@ -78,6 +78,7 @@ TEST_PROGS += test_vxlan_vnifiltering.sh · 77 unmodified lines
78TEST_GEN_FILES += io_uring_zerocopy_tx78TEST_GEN_FILES += io_uring_zerocopy_tx
79TEST_PROGS += io_uring_zerocopy_tx.sh79TEST_PROGS += io_uring_zerocopy_tx.sh
80TEST_GEN_FILES += bind_bhash80TEST_GEN_FILES += bind_bhash
81TEST_GEN_PROGS += netlink-dumps
81TEST_GEN_PROGS += sk_bind_sendto_listen82TEST_GEN_PROGS += sk_bind_sendto_listen
82TEST_GEN_PROGS += sk_connect_zero_addr83TEST_GEN_PROGS += sk_connect_zero_addr
83TEST_GEN_PROGS += sk_so_peek_off84TEST_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
20static 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
46TEST(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
67TEST(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
81TEST(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
110TEST_HARNESS_MAIN
tools/testing/selftests/tc-testing/tc-tests/filters/u32.json+24−0
@@ -329,5 +329,29 @@ · 328 unmodified lines
329 "teardown": [329 "teardown": [
330 "$TC qdisc del dev $DEV1 parent root drr"330 "$TC qdisc del dev $DEV1 parent root drr"
331 ]331 ]
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 ]
332 }356 }
333]357]

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