Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Pull networking fixes from Jakub Kicinski:
"Including fixes from wireless and netfilter.

The notable fixes here are the EEE fix which restores boot for many
embedded platforms (real and QEMU); WiFi warning suppression and the
ICE Kconfig cleanup.

Current release - regressions:

- phy: multiple fixes for EEE rework

- wifi: wext: warn about usage only once

- wifi: ath11k: allow system suspend to survive ath11k

Current release - new code bugs:

- mlx5: Fix memory leak in IPsec RoCE creation

- ibmvnic: assign XPS map to correct queue index

Previous releases - regressions:

- netfilter: ip6t_rpfilter: Fix regression with VRF interfaces

- netfilter: ctnetlink: make event listener tracking global

- nf_tables: allow to fetch set elements when table has an owner

- mlx5:
- fix skb leak while fifo resync and push
- fix possible ptp queue fifo use-after-free

Previous releases - always broken:

- sched: fix action bind logic

- ptp: vclock: use mutex to fix "sleep on atomic" bug if driver also
uses a mutex

- netfilter: conntrack: fix rmmod double-free race

- netfilter: xt_length: use skb len to match in length_mt6, avoid
issues with BIG TCP

Misc:

- ice: remove unnecessary CONFIG_ICE_GNSS

- mlx5e: remove hairpin write debugfs files

- sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy"

* tag 'net-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (53 commits)
tcp: tcp_check_req() can be called from process context
net: phy: c45: fix network interface initialization failures on xtensa, arm:cubieboard
xen-netback: remove unused variables pending_idx and index
net/sched: act_api: move TCA_EXT_WARN_MSG to the correct hierarchy
net: dsa: ocelot_ext: remove unnecessary phylink.h include
net: mscc: ocelot: fix duplicate driver name error
net: dsa: felix: fix internal MDIO controller resource length
net: dsa: seville: ignore mscc-miim read errors from Lynx PCS
net/sched: act_sample: fix action bind logic
net/sched: act_mpls: fix action bind logic
net/sched: act_pedit: fix action bind logic
wifi: wext: warn about usage only once
wifi: mt76: usb: fix use-after-free in mt76u_free_rx_queue
qede: avoid uninitialized entries in coal_entry array
nfc: fix memory leak of se_io context in nfc_genl_se_io
ice: remove unnecessary CONFIG_ICE_GNSS
net/sched: cls_api: Move call to tcf_exts_miss_cookie_base_destroy()
ibmvnic: Assign XPS map to correct queue index
docs: net: fix inaccuracies in msg_zerocopy.rst
tools: net: add __pycache__ to gitignore
...

+546 -318
+1 -1
Documentation/netlink/specs/netdev.yaml
··· 28 28 - 29 29 name: hw-offload 30 30 doc: 31 - This feature informs if netdev supports XDP hw oflloading. 31 + This feature informs if netdev supports XDP hw offloading. 32 32 - 33 33 name: rx-sg 34 34 doc:
+3 -3
Documentation/networking/msg_zerocopy.rst
··· 15 15 16 16 Copying large buffers between user process and kernel can be 17 17 expensive. Linux supports various interfaces that eschew copying, 18 - such as sendpage and splice. The MSG_ZEROCOPY flag extends the 18 + such as sendfile and splice. The MSG_ZEROCOPY flag extends the 19 19 underlying copy avoidance mechanism to common socket send calls. 20 20 21 21 Copy avoidance is not a free lunch. As implemented, with page pinning, ··· 83 83 ret = send(fd, buf, sizeof(buf), MSG_ZEROCOPY); 84 84 85 85 A zerocopy failure will return -1 with errno ENOBUFS. This happens if 86 - the socket option was not set, the socket exceeds its optmem limit or 87 - the user exceeds its ulimit on locked pages. 86 + the socket exceeds its optmem limit or the user exceeds their ulimit on 87 + locked pages. 88 88 89 89 90 90 Mixing copy avoidance and copying
+1 -1
drivers/mfd/ocelot-core.c
··· 177 177 .num_resources = ARRAY_SIZE(vsc7512_miim1_resources), 178 178 .resources = vsc7512_miim1_resources, 179 179 }, { 180 - .name = "ocelot-switch", 180 + .name = "ocelot-ext-switch", 181 181 .of_compatible = "mscc,vsc7512-switch", 182 182 .num_resources = ARRAY_SIZE(vsc7512_switch_resources), 183 183 .resources = vsc7512_switch_resources,
+1 -1
drivers/net/dsa/ocelot/felix_vsc9959.c
··· 554 554 * SGMII/QSGMII MAC PCS can be found. 555 555 */ 556 556 static const struct resource vsc9959_imdio_res = 557 - DEFINE_RES_MEM_NAMED(0x8030, 0x8040, "imdio"); 557 + DEFINE_RES_MEM_NAMED(0x8030, 0x10, "imdio"); 558 558 559 559 static const struct reg_field vsc9959_regfields[REGFIELD_MAX] = { 560 560 [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 6, 6),
+1 -2
drivers/net/dsa/ocelot/ocelot_ext.c
··· 4 4 */ 5 5 6 6 #include <linux/mfd/ocelot.h> 7 - #include <linux/phylink.h> 8 7 #include <linux/platform_device.h> 9 8 #include <linux/regmap.h> 10 9 #include <soc/mscc/ocelot.h> ··· 148 149 149 150 static struct platform_driver ocelot_ext_switch_driver = { 150 151 .driver = { 151 - .name = "ocelot-switch", 152 + .name = "ocelot-ext-switch", 152 153 .of_match_table = of_match_ptr(ocelot_ext_switch_of_match), 153 154 }, 154 155 .probe = ocelot_ext_probe,
+2 -2
drivers/net/dsa/ocelot/seville_vsc9953.c
··· 893 893 894 894 rc = mscc_miim_setup(dev, &bus, "VSC9953 internal MDIO bus", 895 895 ocelot->targets[GCB], 896 - ocelot->map[GCB][GCB_MIIM_MII_STATUS & REG_MASK]); 897 - 896 + ocelot->map[GCB][GCB_MIIM_MII_STATUS & REG_MASK], 897 + true); 898 898 if (rc) { 899 899 dev_err(dev, "failed to setup MDIO bus\n"); 900 900 return rc;
+2 -2
drivers/net/ethernet/ibm/ibmvnic.c
··· 296 296 297 297 rc = __netif_set_xps_queue(adapter->netdev, 298 298 cpumask_bits(queue->affinity_mask), 299 - i, XPS_CPUS); 299 + i_txqs - 1, XPS_CPUS); 300 300 if (rc) 301 301 netdev_warn(adapter->netdev, "%s: Set XPS on queue %d failed, rc = %d.\n", 302 - __func__, i, rc); 302 + __func__, i_txqs - 1, rc); 303 303 } 304 304 305 305 out:
+1 -3
drivers/net/ethernet/intel/Kconfig
··· 296 296 default n 297 297 depends on PCI_MSI 298 298 depends on PTP_1588_CLOCK_OPTIONAL 299 + depends on GNSS || GNSS = n 299 300 select AUXILIARY_BUS 300 301 select DIMLIB 301 302 select NET_DEVLINK ··· 337 336 with PCIe PTM support. The cross-timestamp is available through 338 337 the PTP clock driver precise cross-timestamp ioctl 339 338 (PTP_SYS_OFFSET_PRECISE). 340 - 341 - config ICE_GNSS 342 - def_bool GNSS = y || GNSS = ICE 343 339 344 340 config FM10K 345 341 tristate "Intel(R) FM10000 Ethernet Switch Host Interface Support"
+1 -1
drivers/net/ethernet/intel/ice/Makefile
··· 47 47 ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o 48 48 ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o 49 49 ice-$(CONFIG_ICE_SWITCHDEV) += ice_eswitch.o 50 - ice-$(CONFIG_ICE_GNSS) += ice_gnss.o 50 + ice-$(CONFIG_GNSS) += ice_gnss.o
+2 -2
drivers/net/ethernet/intel/ice/ice_gnss.h
··· 45 45 struct list_head queue; 46 46 }; 47 47 48 - #if IS_ENABLED(CONFIG_ICE_GNSS) 48 + #if IS_ENABLED(CONFIG_GNSS) 49 49 void ice_gnss_init(struct ice_pf *pf); 50 50 void ice_gnss_exit(struct ice_pf *pf); 51 51 bool ice_gnss_is_gps_present(struct ice_hw *hw); ··· 56 56 { 57 57 return false; 58 58 } 59 - #endif /* IS_ENABLED(CONFIG_ICE_GNSS) */ 59 + #endif /* IS_ENABLED(CONFIG_GNSS) */ 60 60 #endif /* _ICE_GNSS_H_ */
+1 -1
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
··· 793 793 794 794 /* NPC profile doesn't extract AH/ESP header fields */ 795 795 if ((ah_esp_mask->spi & ah_esp_hdr->spi) || 796 - (ah_esp_mask->tclass & ah_esp_mask->tclass)) 796 + (ah_esp_mask->tclass & ah_esp_hdr->tclass)) 797 797 return -EOPNOTSUPP; 798 798 799 799 if (flow_type == AH_V6_FLOW)
+57 -19
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
··· 10 10 #include <net/tso.h> 11 11 #include <linux/bpf.h> 12 12 #include <linux/bpf_trace.h> 13 + #include <net/ip6_checksum.h> 13 14 14 15 #include "otx2_reg.h" 15 16 #include "otx2_common.h" ··· 700 699 701 700 static void otx2_sqe_add_mem(struct otx2_snd_queue *sq, int *offset, 702 701 int alg, u64 iova, int ptp_offset, 703 - u64 base_ns, int udp_csum) 702 + u64 base_ns, bool udp_csum_crt) 704 703 { 705 704 struct nix_sqe_mem_s *mem; 706 705 ··· 712 711 713 712 if (ptp_offset) { 714 713 mem->start_offset = ptp_offset; 715 - mem->udp_csum_crt = udp_csum; 714 + mem->udp_csum_crt = !!udp_csum_crt; 716 715 mem->base_ns = base_ns; 717 716 mem->step_type = 1; 718 717 } ··· 987 986 return false; 988 987 } 989 988 990 - static bool otx2_ptp_is_sync(struct sk_buff *skb, int *offset, int *udp_csum) 989 + static bool otx2_ptp_is_sync(struct sk_buff *skb, int *offset, bool *udp_csum_crt) 991 990 { 992 991 struct ethhdr *eth = (struct ethhdr *)(skb->data); 993 992 u16 nix_offload_hlen = 0, inner_vhlen = 0; 993 + bool udp_hdr_present = false, is_sync; 994 994 u8 *data = skb->data, *msgtype; 995 995 __be16 proto = eth->h_proto; 996 996 int network_depth = 0; ··· 1031 1029 if (!otx2_validate_network_transport(skb)) 1032 1030 return false; 1033 1031 1034 - *udp_csum = 1; 1035 1032 *offset = nix_offload_hlen + skb_transport_offset(skb) + 1036 1033 sizeof(struct udphdr); 1034 + udp_hdr_present = true; 1035 + 1037 1036 } 1038 1037 1039 1038 msgtype = data + *offset; 1040 - 1041 1039 /* Check PTP messageId is SYNC or not */ 1042 - return (*msgtype & 0xf) == 0; 1040 + is_sync = !(*msgtype & 0xf); 1041 + if (is_sync) 1042 + *udp_csum_crt = udp_hdr_present; 1043 + else 1044 + *offset = 0; 1045 + 1046 + return is_sync; 1043 1047 } 1044 1048 1045 1049 static void otx2_set_txtstamp(struct otx2_nic *pfvf, struct sk_buff *skb, 1046 1050 struct otx2_snd_queue *sq, int *offset) 1047 1051 { 1052 + struct ethhdr *eth = (struct ethhdr *)(skb->data); 1048 1053 struct ptpv2_tstamp *origin_tstamp; 1049 - int ptp_offset = 0, udp_csum = 0; 1054 + bool udp_csum_crt = false; 1055 + unsigned int udphoff; 1050 1056 struct timespec64 ts; 1057 + int ptp_offset = 0; 1058 + __wsum skb_csum; 1051 1059 u64 iova; 1052 1060 1053 1061 if (unlikely(!skb_shinfo(skb)->gso_size && 1054 1062 (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))) { 1055 - if (unlikely(pfvf->flags & OTX2_FLAG_PTP_ONESTEP_SYNC)) { 1056 - if (otx2_ptp_is_sync(skb, &ptp_offset, &udp_csum)) { 1057 - origin_tstamp = (struct ptpv2_tstamp *) 1058 - ((u8 *)skb->data + ptp_offset + 1059 - PTP_SYNC_SEC_OFFSET); 1060 - ts = ns_to_timespec64(pfvf->ptp->tstamp); 1061 - origin_tstamp->seconds_msb = htons((ts.tv_sec >> 32) & 0xffff); 1062 - origin_tstamp->seconds_lsb = htonl(ts.tv_sec & 0xffffffff); 1063 - origin_tstamp->nanoseconds = htonl(ts.tv_nsec); 1064 - /* Point to correction field in PTP packet */ 1065 - ptp_offset += 8; 1063 + if (unlikely(pfvf->flags & OTX2_FLAG_PTP_ONESTEP_SYNC && 1064 + otx2_ptp_is_sync(skb, &ptp_offset, &udp_csum_crt))) { 1065 + origin_tstamp = (struct ptpv2_tstamp *) 1066 + ((u8 *)skb->data + ptp_offset + 1067 + PTP_SYNC_SEC_OFFSET); 1068 + ts = ns_to_timespec64(pfvf->ptp->tstamp); 1069 + origin_tstamp->seconds_msb = htons((ts.tv_sec >> 32) & 0xffff); 1070 + origin_tstamp->seconds_lsb = htonl(ts.tv_sec & 0xffffffff); 1071 + origin_tstamp->nanoseconds = htonl(ts.tv_nsec); 1072 + /* Point to correction field in PTP packet */ 1073 + ptp_offset += 8; 1074 + 1075 + /* When user disables hw checksum, stack calculates the csum, 1076 + * but it does not cover ptp timestamp which is added later. 1077 + * Recalculate the checksum manually considering the timestamp. 1078 + */ 1079 + if (udp_csum_crt) { 1080 + struct udphdr *uh = udp_hdr(skb); 1081 + 1082 + if (skb->ip_summed != CHECKSUM_PARTIAL && uh->check != 0) { 1083 + udphoff = skb_transport_offset(skb); 1084 + uh->check = 0; 1085 + skb_csum = skb_checksum(skb, udphoff, skb->len - udphoff, 1086 + 0); 1087 + if (ntohs(eth->h_proto) == ETH_P_IPV6) 1088 + uh->check = csum_ipv6_magic(&ipv6_hdr(skb)->saddr, 1089 + &ipv6_hdr(skb)->daddr, 1090 + skb->len - udphoff, 1091 + ipv6_hdr(skb)->nexthdr, 1092 + skb_csum); 1093 + else 1094 + uh->check = csum_tcpudp_magic(ip_hdr(skb)->saddr, 1095 + ip_hdr(skb)->daddr, 1096 + skb->len - udphoff, 1097 + IPPROTO_UDP, 1098 + skb_csum); 1099 + } 1066 1100 } 1067 1101 } else { 1068 1102 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 1069 1103 } 1070 1104 iova = sq->timestamps->iova + (sq->head * sizeof(u64)); 1071 1105 otx2_sqe_add_mem(sq, offset, NIX_SENDMEMALG_E_SETTSTMP, iova, 1072 - ptp_offset, pfvf->ptp->base_ns, udp_csum); 1106 + ptp_offset, pfvf->ptp->base_ns, udp_csum_crt); 1073 1107 } else { 1074 1108 skb_tx_timestamp(skb); 1075 1109 }
+4
drivers/net/ethernet/mellanox/mlx5/core/ecpf.c
··· 98 98 err = mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_HOST_PF]); 99 99 if (err) 100 100 mlx5_core_warn(dev, "Timeout reclaiming external host PF pages err(%d)\n", err); 101 + 102 + err = mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_VF]); 103 + if (err) 104 + mlx5_core_warn(dev, "Timeout reclaiming external host VFs pages err(%d)\n", err); 101 105 }
+22 -3
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
··· 86 86 return (ptpsq->ts_cqe_ctr_mask && (skb_cc != skb_id)); 87 87 } 88 88 89 - static void mlx5e_ptp_skb_fifo_ts_cqe_resync(struct mlx5e_ptpsq *ptpsq, u16 skb_cc, u16 skb_id) 89 + static bool mlx5e_ptp_ts_cqe_ooo(struct mlx5e_ptpsq *ptpsq, u16 skb_id) 90 + { 91 + u16 skb_cc = PTP_WQE_CTR2IDX(ptpsq->skb_fifo_cc); 92 + u16 skb_pc = PTP_WQE_CTR2IDX(ptpsq->skb_fifo_pc); 93 + 94 + if (PTP_WQE_CTR2IDX(skb_id - skb_cc) >= PTP_WQE_CTR2IDX(skb_pc - skb_cc)) 95 + return true; 96 + 97 + return false; 98 + } 99 + 100 + static void mlx5e_ptp_skb_fifo_ts_cqe_resync(struct mlx5e_ptpsq *ptpsq, u16 skb_cc, 101 + u16 skb_id, int budget) 90 102 { 91 103 struct skb_shared_hwtstamps hwts = {}; 92 104 struct sk_buff *skb; ··· 110 98 hwts.hwtstamp = mlx5e_skb_cb_get_hwts(skb)->cqe_hwtstamp; 111 99 skb_tstamp_tx(skb, &hwts); 112 100 ptpsq->cq_stats->resync_cqe++; 101 + napi_consume_skb(skb, budget); 113 102 skb_cc = PTP_WQE_CTR2IDX(ptpsq->skb_fifo_cc); 114 103 } 115 104 } ··· 131 118 goto out; 132 119 } 133 120 134 - if (mlx5e_ptp_ts_cqe_drop(ptpsq, skb_cc, skb_id)) 135 - mlx5e_ptp_skb_fifo_ts_cqe_resync(ptpsq, skb_cc, skb_id); 121 + if (mlx5e_ptp_ts_cqe_drop(ptpsq, skb_cc, skb_id)) { 122 + if (mlx5e_ptp_ts_cqe_ooo(ptpsq, skb_id)) { 123 + /* already handled by a previous resync */ 124 + ptpsq->cq_stats->ooo_cqe_drop++; 125 + return; 126 + } 127 + mlx5e_ptp_skb_fifo_ts_cqe_resync(ptpsq, skb_cc, skb_id, budget); 128 + } 136 129 137 130 skb = mlx5e_skb_fifo_pop(&ptpsq->skb_fifo); 138 131 hwtstamp = mlx5e_cqe_ts_to_ns(sq->ptp_cyc2time, sq->clock, get_cqe_ts(cqe));
+1 -2
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
··· 710 710 else 711 711 napi_gro_receive(rq->cq.napi, skb); 712 712 713 - if (tc_priv.fwd_dev) 714 - dev_put(tc_priv.fwd_dev); 713 + dev_put(tc_priv.fwd_dev); 715 714 716 715 return; 717 716
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c
··· 37 37 int err; 38 38 39 39 handle = kvzalloc(sizeof(*handle), GFP_KERNEL); 40 - if (IS_ERR(handle)) 40 + if (!handle) 41 41 return ERR_PTR(-ENOMEM); 42 42 43 43 err = rhashtable_init(&handle->ht, &act_counters_ht_params);
+3 -1
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
··· 86 86 static inline bool 87 87 mlx5e_skb_fifo_has_room(struct mlx5e_skb_fifo *fifo) 88 88 { 89 - return (*fifo->pc - *fifo->cc) < fifo->mask; 89 + return (u16)(*fifo->pc - *fifo->cc) < fifo->mask; 90 90 } 91 91 92 92 static inline bool ··· 302 302 static inline 303 303 struct sk_buff *mlx5e_skb_fifo_pop(struct mlx5e_skb_fifo *fifo) 304 304 { 305 + WARN_ON_ONCE(*fifo->pc == *fifo->cc); 306 + 305 307 return *mlx5e_skb_fifo_get(fifo, (*fifo->cc)++); 306 308 } 307 309
+1
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
··· 2138 2138 { MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, abort_abs_diff_ns) }, 2139 2139 { MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, resync_cqe) }, 2140 2140 { MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, resync_event) }, 2141 + { MLX5E_DECLARE_PTP_CQ_STAT(struct mlx5e_ptp_cq_stats, ooo_cqe_drop) }, 2141 2142 }; 2142 2143 2143 2144 static const struct counter_desc ptp_rq_stats_desc[] = {
+1
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
··· 461 461 u64 abort_abs_diff_ns; 462 462 u64 resync_cqe; 463 463 u64 resync_event; 464 + u64 ooo_cqe_drop; 464 465 }; 465 466 466 467 struct mlx5e_rep_stats {
-59
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 1048 1048 return 0; 1049 1049 } 1050 1050 1051 - static int debugfs_hairpin_queues_set(void *data, u64 val) 1052 - { 1053 - struct mlx5e_hairpin_params *hp = data; 1054 - 1055 - if (!val) { 1056 - mlx5_core_err(hp->mdev, 1057 - "Number of hairpin queues must be > 0\n"); 1058 - return -EINVAL; 1059 - } 1060 - 1061 - hp->num_queues = val; 1062 - 1063 - return 0; 1064 - } 1065 - 1066 - static int debugfs_hairpin_queues_get(void *data, u64 *val) 1067 - { 1068 - struct mlx5e_hairpin_params *hp = data; 1069 - 1070 - *val = hp->num_queues; 1071 - 1072 - return 0; 1073 - } 1074 - DEFINE_DEBUGFS_ATTRIBUTE(fops_hairpin_queues, debugfs_hairpin_queues_get, 1075 - debugfs_hairpin_queues_set, "%llu\n"); 1076 - 1077 - static int debugfs_hairpin_queue_size_set(void *data, u64 val) 1078 - { 1079 - struct mlx5e_hairpin_params *hp = data; 1080 - 1081 - if (val > BIT(MLX5_CAP_GEN(hp->mdev, log_max_hairpin_num_packets))) { 1082 - mlx5_core_err(hp->mdev, 1083 - "Invalid hairpin queue size, must be <= %lu\n", 1084 - BIT(MLX5_CAP_GEN(hp->mdev, 1085 - log_max_hairpin_num_packets))); 1086 - return -EINVAL; 1087 - } 1088 - 1089 - hp->queue_size = roundup_pow_of_two(val); 1090 - 1091 - return 0; 1092 - } 1093 - 1094 - static int debugfs_hairpin_queue_size_get(void *data, u64 *val) 1095 - { 1096 - struct mlx5e_hairpin_params *hp = data; 1097 - 1098 - *val = hp->queue_size; 1099 - 1100 - return 0; 1101 - } 1102 - DEFINE_DEBUGFS_ATTRIBUTE(fops_hairpin_queue_size, 1103 - debugfs_hairpin_queue_size_get, 1104 - debugfs_hairpin_queue_size_set, "%llu\n"); 1105 - 1106 1051 static int debugfs_hairpin_num_active_get(void *data, u64 *val) 1107 1052 { 1108 1053 struct mlx5e_tc_table *tc = data; ··· 1093 1148 1094 1149 tc->dfs_root = debugfs_create_dir("tc", dfs_root); 1095 1150 1096 - debugfs_create_file("hairpin_num_queues", 0644, tc->dfs_root, 1097 - &tc->hairpin_params, &fops_hairpin_queues); 1098 - debugfs_create_file("hairpin_queue_size", 0644, tc->dfs_root, 1099 - &tc->hairpin_params, &fops_hairpin_queue_size); 1100 1151 debugfs_create_file("hairpin_num_active", 0444, tc->dfs_root, tc, 1101 1152 &fops_hairpin_num_active); 1102 1153 debugfs_create_file("hairpin_table_dump", 0444, tc->dfs_root, tc,
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 869 869 dest.vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID; 870 870 flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; 871 871 872 - if (rep->vport == MLX5_VPORT_UPLINK) 872 + if (MLX5_CAP_ESW_FLOWTABLE(on_esw->dev, flow_source) && 873 + rep->vport == MLX5_VPORT_UPLINK) 873 874 spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_LOCAL_VPORT; 874 875 875 876 flow_rule = mlx5_add_flow_rules(mlx5_eswitch_get_slow_fdb(on_esw),
+1
drivers/net/ethernet/mellanox/mlx5/core/lib/geneve.c
··· 105 105 geneve->opt_type = opt->type; 106 106 geneve->obj_id = res; 107 107 geneve->refcount++; 108 + res = 0; 108 109 } 109 110 110 111 unlock:
+8 -5
drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c
··· 162 162 if (IS_ERR(ft)) { 163 163 err = PTR_ERR(ft); 164 164 mlx5_core_err(mdev, "Fail to create RoCE IPsec tx ft err=%d\n", err); 165 - return err; 165 + goto free_in; 166 166 } 167 167 168 168 roce->ft = ft; ··· 174 174 if (IS_ERR(g)) { 175 175 err = PTR_ERR(g); 176 176 mlx5_core_err(mdev, "Fail to create RoCE IPsec tx group err=%d\n", err); 177 - goto fail; 177 + goto destroy_table; 178 178 } 179 179 roce->g = g; 180 180 181 181 err = ipsec_fs_roce_tx_rule_setup(mdev, roce, pol_ft); 182 182 if (err) { 183 183 mlx5_core_err(mdev, "Fail to create RoCE IPsec tx rules err=%d\n", err); 184 - goto rule_fail; 184 + goto destroy_group; 185 185 } 186 186 187 + kvfree(in); 187 188 return 0; 188 189 189 - rule_fail: 190 + destroy_group: 190 191 mlx5_destroy_flow_group(roce->g); 191 - fail: 192 + destroy_table: 192 193 mlx5_destroy_flow_table(ft); 194 + free_in: 195 + kvfree(in); 193 196 return err; 194 197 } 195 198
+4
drivers/net/ethernet/mellanox/mlx5/core/sriov.c
··· 147 147 148 148 mlx5_eswitch_disable_sriov(dev->priv.eswitch, clear_vf); 149 149 150 + /* For ECPFs, skip waiting for host VF pages until ECPF is destroyed */ 151 + if (mlx5_core_is_ecpf(dev)) 152 + return; 153 + 150 154 if (mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_VF])) 151 155 mlx5_core_warn(dev, "timeout reclaiming VFs pages\n"); 152 156 }
+7 -14
drivers/net/ethernet/qlogic/qede/qede_main.c
··· 963 963 { 964 964 u8 fp_combined, fp_rx = edev->fp_num_rx; 965 965 struct qede_fastpath *fp; 966 - void *mem; 967 966 int i; 968 967 969 968 edev->fp_array = kcalloc(QEDE_QUEUE_CNT(edev), ··· 973 974 } 974 975 975 976 if (!edev->coal_entry) { 976 - mem = kcalloc(QEDE_MAX_RSS_CNT(edev), 977 - sizeof(*edev->coal_entry), GFP_KERNEL); 978 - } else { 979 - mem = krealloc(edev->coal_entry, 980 - QEDE_QUEUE_CNT(edev) * sizeof(*edev->coal_entry), 981 - GFP_KERNEL); 977 + edev->coal_entry = kcalloc(QEDE_MAX_RSS_CNT(edev), 978 + sizeof(*edev->coal_entry), 979 + GFP_KERNEL); 980 + if (!edev->coal_entry) { 981 + DP_ERR(edev, "coalesce entry allocation failed\n"); 982 + goto err; 983 + } 982 984 } 983 - 984 - if (!mem) { 985 - DP_ERR(edev, "coalesce entry allocation failed\n"); 986 - kfree(edev->coal_entry); 987 - goto err; 988 - } 989 - edev->coal_entry = mem; 990 985 991 986 fp_combined = QEDE_QUEUE_CNT(edev) - fp_rx - edev->fp_num_tx; 992 987
+4 -2
drivers/net/ethernet/sun/sunhme.c
··· 2894 2894 goto err_out_clear_quattro; 2895 2895 } 2896 2896 2897 - hpreg_res = devm_request_region(&pdev->dev, pci_resource_start(pdev, 0), 2898 - pci_resource_len(pdev, 0), DRV_NAME); 2897 + hpreg_res = devm_request_mem_region(&pdev->dev, 2898 + pci_resource_start(pdev, 0), 2899 + pci_resource_len(pdev, 0), 2900 + DRV_NAME); 2899 2901 if (!hpreg_res) { 2900 2902 err = -EBUSY; 2901 2903 dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting.\n");
+6 -3
drivers/net/mdio/mdio-mscc-miim.c
··· 52 52 struct mscc_miim_dev { 53 53 struct regmap *regs; 54 54 int mii_status_offset; 55 + bool ignore_read_errors; 55 56 struct regmap *phy_regs; 56 57 const struct mscc_miim_info *info; 57 58 struct clk *clk; ··· 136 135 goto out; 137 136 } 138 137 139 - if (val & MSCC_MIIM_DATA_ERROR) { 138 + if (!miim->ignore_read_errors && !!(val & MSCC_MIIM_DATA_ERROR)) { 140 139 ret = -EIO; 141 140 goto out; 142 141 } ··· 213 212 }; 214 213 215 214 int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name, 216 - struct regmap *mii_regmap, int status_offset) 215 + struct regmap *mii_regmap, int status_offset, 216 + bool ignore_read_errors) 217 217 { 218 218 struct mscc_miim_dev *miim; 219 219 struct mii_bus *bus; ··· 236 234 237 235 miim->regs = mii_regmap; 238 236 miim->mii_status_offset = status_offset; 237 + miim->ignore_read_errors = ignore_read_errors; 239 238 240 239 *pbus = bus; 241 240 ··· 288 285 return dev_err_probe(dev, PTR_ERR(phy_regmap), 289 286 "Unable to create phy register regmap\n"); 290 287 291 - ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0); 288 + ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0, false); 292 289 if (ret < 0) { 293 290 dev_err(dev, "Unable to setup the MDIO bus\n"); 294 291 return ret;
+43 -13
drivers/net/phy/phy-c45.c
··· 262 262 linkmode_and(phydev->advertising, phydev->advertising, 263 263 phydev->supported); 264 264 265 - ret = genphy_c45_write_eee_adv(phydev, phydev->supported_eee); 265 + ret = genphy_c45_an_config_eee_aneg(phydev); 266 266 if (ret < 0) 267 267 return ret; 268 268 else if (ret) ··· 672 672 */ 673 673 int genphy_c45_write_eee_adv(struct phy_device *phydev, unsigned long *adv) 674 674 { 675 - int val, changed; 675 + int val, changed = 0; 676 676 677 - if (linkmode_intersects(phydev->supported, PHY_EEE_CAP1_FEATURES)) { 677 + if (linkmode_intersects(phydev->supported_eee, PHY_EEE_CAP1_FEATURES)) { 678 678 val = linkmode_to_mii_eee_cap1_t(adv); 679 679 680 680 /* In eee_broken_modes are stored MDIO_AN_EEE_ADV specific raw ··· 721 721 * @phydev: target phy_device struct 722 722 * @adv: the linkmode advertisement status 723 723 */ 724 - static int genphy_c45_read_eee_adv(struct phy_device *phydev, 725 - unsigned long *adv) 724 + int genphy_c45_read_eee_adv(struct phy_device *phydev, unsigned long *adv) 726 725 { 727 726 int val; 728 727 729 - if (linkmode_intersects(phydev->supported, PHY_EEE_CAP1_FEATURES)) { 728 + if (linkmode_intersects(phydev->supported_eee, PHY_EEE_CAP1_FEATURES)) { 730 729 /* IEEE 802.3-2018 45.2.7.13 EEE advertisement 1 731 730 * (Register 7.60) 732 731 */ ··· 761 762 { 762 763 int val; 763 764 764 - if (linkmode_intersects(phydev->supported, PHY_EEE_CAP1_FEATURES)) { 765 + if (linkmode_intersects(phydev->supported_eee, PHY_EEE_CAP1_FEATURES)) { 765 766 /* IEEE 802.3-2018 45.2.7.14 EEE link partner ability 1 766 767 * (Register 7.61) 767 768 */ ··· 856 857 return 0; 857 858 } 858 859 EXPORT_SYMBOL_GPL(genphy_c45_read_eee_abilities); 860 + 861 + /** 862 + * genphy_c45_an_config_eee_aneg - configure EEE advertisement 863 + * @phydev: target phy_device struct 864 + */ 865 + int genphy_c45_an_config_eee_aneg(struct phy_device *phydev) 866 + { 867 + if (!phydev->eee_enabled) { 868 + __ETHTOOL_DECLARE_LINK_MODE_MASK(adv) = {}; 869 + 870 + return genphy_c45_write_eee_adv(phydev, adv); 871 + } 872 + 873 + return genphy_c45_write_eee_adv(phydev, phydev->advertising_eee); 874 + } 859 875 860 876 /** 861 877 * genphy_c45_pma_read_abilities - read supported link modes from PMA ··· 1435 1421 int genphy_c45_ethtool_set_eee(struct phy_device *phydev, 1436 1422 struct ethtool_eee *data) 1437 1423 { 1438 - __ETHTOOL_DECLARE_LINK_MODE_MASK(adv) = {}; 1439 1424 int ret; 1440 1425 1441 1426 if (data->eee_enabled) { 1442 - if (data->advertised) 1443 - adv[0] = data->advertised; 1444 - else 1445 - linkmode_copy(adv, phydev->supported_eee); 1427 + if (data->advertised) { 1428 + __ETHTOOL_DECLARE_LINK_MODE_MASK(adv); 1429 + 1430 + ethtool_convert_legacy_u32_to_link_mode(adv, 1431 + data->advertised); 1432 + linkmode_andnot(adv, adv, phydev->supported_eee); 1433 + if (!linkmode_empty(adv)) { 1434 + phydev_warn(phydev, "At least some EEE link modes are not supported.\n"); 1435 + return -EINVAL; 1436 + } 1437 + 1438 + ethtool_convert_legacy_u32_to_link_mode(phydev->advertising_eee, 1439 + data->advertised); 1440 + } else { 1441 + linkmode_copy(phydev->advertising_eee, 1442 + phydev->supported_eee); 1443 + } 1444 + 1445 + phydev->eee_enabled = true; 1446 + } else { 1447 + phydev->eee_enabled = false; 1446 1448 } 1447 1449 1448 - ret = genphy_c45_write_eee_adv(phydev, adv); 1450 + ret = genphy_c45_an_config_eee_aneg(phydev); 1449 1451 if (ret < 0) 1450 1452 return ret; 1451 1453 if (ret > 0)
+20 -1
drivers/net/phy/phy_device.c
··· 2231 2231 { 2232 2232 int err; 2233 2233 2234 - err = genphy_c45_write_eee_adv(phydev, phydev->supported_eee); 2234 + err = genphy_c45_an_config_eee_aneg(phydev); 2235 2235 if (err < 0) 2236 2236 return err; 2237 2237 else if (err) ··· 3140 3140 3141 3141 of_set_phy_supported(phydev); 3142 3142 phy_advertise_supported(phydev); 3143 + 3144 + /* Get PHY default EEE advertising modes and handle them as potentially 3145 + * safe initial configuration. 3146 + */ 3147 + err = genphy_c45_read_eee_adv(phydev, phydev->advertising_eee); 3148 + if (err) 3149 + return err; 3150 + 3151 + /* There is no "enabled" flag. If PHY is advertising, assume it is 3152 + * kind of enabled. 3153 + */ 3154 + phydev->eee_enabled = !linkmode_empty(phydev->advertising_eee); 3155 + 3156 + /* Some PHYs may advertise, by default, not support EEE modes. So, 3157 + * we need to clean them. 3158 + */ 3159 + if (phydev->eee_enabled) 3160 + linkmode_and(phydev->advertising_eee, phydev->supported_eee, 3161 + phydev->advertising_eee); 3143 3162 3144 3163 /* Get the EEE modes we want to prohibit. We will ask 3145 3164 * the PHY stop advertising these mode later on
+1 -1
drivers/net/wireless/ath/ath11k/pci.c
··· 981 981 if (ret) 982 982 ath11k_warn(ab, "failed to suspend core: %d\n", ret); 983 983 984 - return ret; 984 + return 0; 985 985 } 986 986 987 987 static __maybe_unused int ath11k_pci_pm_resume(struct device *dev)
+1
drivers/net/wireless/mediatek/mt76/usb.c
··· 706 706 q->entry[i].urb = NULL; 707 707 } 708 708 page_pool_destroy(q->page_pool); 709 + q->page_pool = NULL; 709 710 } 710 711 711 712 static void mt76u_free_rx(struct mt76_dev *dev)
-5
drivers/net/xen-netback/netback.c
··· 883 883 struct xen_netif_tx_request txfrags[XEN_NETBK_LEGACY_SLOTS_MAX]; 884 884 struct xen_netif_extra_info extras[XEN_NETIF_EXTRA_TYPE_MAX-1]; 885 885 unsigned int extra_count; 886 - u16 pending_idx; 887 886 RING_IDX idx; 888 887 int work_to_do; 889 888 unsigned int data_len; 890 - pending_ring_idx_t index; 891 889 892 890 if (queue->tx.sring->req_prod - queue->tx.req_cons > 893 891 XEN_NETIF_TX_RING_SIZE) { ··· 980 982 xenvif_fatal_tx_err(queue->vif); 981 983 break; 982 984 } 983 - 984 - index = pending_index(queue->pending_cons); 985 - pending_idx = queue->pending_ring[index]; 986 985 987 986 if (ret >= XEN_NETBK_LEGACY_SLOTS_MAX - 1 && data_len < txreq.size) 988 987 data_len = txreq.size;
+6
drivers/nfc/st-nci/se.c
··· 672 672 ST_NCI_EVT_TRANSMIT_DATA, apdu, 673 673 apdu_length); 674 674 default: 675 + /* Need to free cb_context here as at the moment we can't 676 + * clearly indicate to the caller if the callback function 677 + * would be called (and free it) or not. In both cases a 678 + * negative value may be returned to the caller. 679 + */ 680 + kfree(cb_context); 675 681 return -ENODEV; 676 682 } 677 683 }
+6
drivers/nfc/st21nfca/se.c
··· 236 236 ST21NFCA_EVT_TRANSMIT_DATA, 237 237 apdu, apdu_length); 238 238 default: 239 + /* Need to free cb_context here as at the moment we can't 240 + * clearly indicate to the caller if the callback function 241 + * would be called (and free it) or not. In both cases a 242 + * negative value may be returned to the caller. 243 + */ 244 + kfree(cb_context); 239 245 return -ENODEV; 240 246 } 241 247 }
+1 -1
drivers/ptp/ptp_private.h
··· 66 66 struct hlist_node vclock_hash_node; 67 67 struct cyclecounter cc; 68 68 struct timecounter tc; 69 - spinlock_t lock; /* protects tc/cc */ 69 + struct mutex lock; /* protects tc/cc */ 70 70 }; 71 71 72 72 /*
+22 -22
drivers/ptp/ptp_vclock.c
··· 43 43 static int ptp_vclock_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) 44 44 { 45 45 struct ptp_vclock *vclock = info_to_vclock(ptp); 46 - unsigned long flags; 47 46 s64 adj; 48 47 49 48 adj = (s64)scaled_ppm << PTP_VCLOCK_FADJ_SHIFT; 50 49 adj = div_s64(adj, PTP_VCLOCK_FADJ_DENOMINATOR); 51 50 52 - spin_lock_irqsave(&vclock->lock, flags); 51 + if (mutex_lock_interruptible(&vclock->lock)) 52 + return -EINTR; 53 53 timecounter_read(&vclock->tc); 54 54 vclock->cc.mult = PTP_VCLOCK_CC_MULT + adj; 55 - spin_unlock_irqrestore(&vclock->lock, flags); 55 + mutex_unlock(&vclock->lock); 56 56 57 57 return 0; 58 58 } ··· 60 60 static int ptp_vclock_adjtime(struct ptp_clock_info *ptp, s64 delta) 61 61 { 62 62 struct ptp_vclock *vclock = info_to_vclock(ptp); 63 - unsigned long flags; 64 63 65 - spin_lock_irqsave(&vclock->lock, flags); 64 + if (mutex_lock_interruptible(&vclock->lock)) 65 + return -EINTR; 66 66 timecounter_adjtime(&vclock->tc, delta); 67 - spin_unlock_irqrestore(&vclock->lock, flags); 67 + mutex_unlock(&vclock->lock); 68 68 69 69 return 0; 70 70 } ··· 73 73 struct timespec64 *ts) 74 74 { 75 75 struct ptp_vclock *vclock = info_to_vclock(ptp); 76 - unsigned long flags; 77 76 u64 ns; 78 77 79 - spin_lock_irqsave(&vclock->lock, flags); 78 + if (mutex_lock_interruptible(&vclock->lock)) 79 + return -EINTR; 80 80 ns = timecounter_read(&vclock->tc); 81 - spin_unlock_irqrestore(&vclock->lock, flags); 81 + mutex_unlock(&vclock->lock); 82 82 *ts = ns_to_timespec64(ns); 83 83 84 84 return 0; ··· 91 91 struct ptp_vclock *vclock = info_to_vclock(ptp); 92 92 struct ptp_clock *pptp = vclock->pclock; 93 93 struct timespec64 pts; 94 - unsigned long flags; 95 94 int err; 96 95 u64 ns; 97 96 ··· 98 99 if (err) 99 100 return err; 100 101 101 - spin_lock_irqsave(&vclock->lock, flags); 102 + if (mutex_lock_interruptible(&vclock->lock)) 103 + return -EINTR; 102 104 ns = timecounter_cyc2time(&vclock->tc, timespec64_to_ns(&pts)); 103 - spin_unlock_irqrestore(&vclock->lock, flags); 105 + mutex_unlock(&vclock->lock); 104 106 105 107 *ts = ns_to_timespec64(ns); 106 108 ··· 113 113 { 114 114 struct ptp_vclock *vclock = info_to_vclock(ptp); 115 115 u64 ns = timespec64_to_ns(ts); 116 - unsigned long flags; 117 116 118 - spin_lock_irqsave(&vclock->lock, flags); 117 + if (mutex_lock_interruptible(&vclock->lock)) 118 + return -EINTR; 119 119 timecounter_init(&vclock->tc, &vclock->cc, ns); 120 - spin_unlock_irqrestore(&vclock->lock, flags); 120 + mutex_unlock(&vclock->lock); 121 121 122 122 return 0; 123 123 } ··· 127 127 { 128 128 struct ptp_vclock *vclock = info_to_vclock(ptp); 129 129 struct ptp_clock *pptp = vclock->pclock; 130 - unsigned long flags; 131 130 int err; 132 131 u64 ns; 133 132 ··· 134 135 if (err) 135 136 return err; 136 137 137 - spin_lock_irqsave(&vclock->lock, flags); 138 + if (mutex_lock_interruptible(&vclock->lock)) 139 + return -EINTR; 138 140 ns = timecounter_cyc2time(&vclock->tc, ktime_to_ns(xtstamp->device)); 139 - spin_unlock_irqrestore(&vclock->lock, flags); 141 + mutex_unlock(&vclock->lock); 140 142 141 143 xtstamp->device = ns_to_ktime(ns); 142 144 ··· 205 205 206 206 INIT_HLIST_NODE(&vclock->vclock_hash_node); 207 207 208 - spin_lock_init(&vclock->lock); 208 + mutex_init(&vclock->lock); 209 209 210 210 vclock->clock = ptp_clock_register(&vclock->info, &pclock->dev); 211 211 if (IS_ERR_OR_NULL(vclock->clock)) { ··· 269 269 { 270 270 unsigned int hash = vclock_index % HASH_SIZE(vclock_hash); 271 271 struct ptp_vclock *vclock; 272 - unsigned long flags; 273 272 u64 ns; 274 273 u64 vclock_ns = 0; 275 274 ··· 280 281 if (vclock->clock->index != vclock_index) 281 282 continue; 282 283 283 - spin_lock_irqsave(&vclock->lock, flags); 284 + if (mutex_lock_interruptible(&vclock->lock)) 285 + break; 284 286 vclock_ns = timecounter_cyc2time(&vclock->tc, ns); 285 - spin_unlock_irqrestore(&vclock->lock, flags); 287 + mutex_unlock(&vclock->lock); 286 288 break; 287 289 } 288 290
+1 -1
include/linux/mdio/mdio-mscc-miim.h
··· 14 14 15 15 int mscc_miim_setup(struct device *device, struct mii_bus **bus, 16 16 const char *name, struct regmap *mii_regmap, 17 - int status_offset); 17 + int status_offset, bool ignore_read_errors); 18 18 19 19 #endif
+5
include/linux/netfilter.h
··· 491 491 */ 492 492 DECLARE_PER_CPU(bool, nf_skb_duplicated); 493 493 494 + /** 495 + * Contains bitmask of ctnetlink event subscribers, if any. 496 + * Can't be pernet due to NETLINK_LISTEN_ALL_NSID setsockopt flag. 497 + */ 498 + extern u8 nf_ctnetlink_has_listener; 494 499 #endif /*__LINUX_NETFILTER_H*/
+6
include/linux/phy.h
··· 575 575 * @advertising: Currently advertised linkmodes 576 576 * @adv_old: Saved advertised while power saving for WoL 577 577 * @supported_eee: supported PHY EEE linkmodes 578 + * @advertising_eee: Currently advertised EEE linkmodes 579 + * @eee_enabled: Flag indicating whether the EEE feature is enabled 578 580 * @lp_advertising: Current link partner advertised linkmodes 579 581 * @host_interfaces: PHY interface modes supported by host 580 582 * @eee_broken_modes: Energy efficient ethernet modes which should be prohibited ··· 683 681 __ETHTOOL_DECLARE_LINK_MODE_MASK(adv_old); 684 682 /* used for eee validation */ 685 683 __ETHTOOL_DECLARE_LINK_MODE_MASK(supported_eee); 684 + __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising_eee); 685 + bool eee_enabled; 686 686 687 687 /* Host supported PHY interface types. Should be ignored if empty. */ 688 688 DECLARE_PHY_INTERFACE_MASK(host_interfaces); ··· 1769 1765 int genphy_c45_ethtool_set_eee(struct phy_device *phydev, 1770 1766 struct ethtool_eee *data); 1771 1767 int genphy_c45_write_eee_adv(struct phy_device *phydev, unsigned long *adv); 1768 + int genphy_c45_an_config_eee_aneg(struct phy_device *phydev); 1769 + int genphy_c45_read_eee_adv(struct phy_device *phydev, unsigned long *adv); 1772 1770 1773 1771 /* Generic C45 PHY driver */ 1774 1772 extern struct phy_driver genphy_c45_driver;
-1
include/net/netns/conntrack.h
··· 95 95 96 96 struct netns_ct { 97 97 #ifdef CONFIG_NF_CONNTRACK_EVENTS 98 - u8 ctnetlink_has_listener; 99 98 bool ecache_dwork_pending; 100 99 #endif 101 100 u8 sysctl_log_invalid; /* Log invalid packets */
+1
include/net/sctp/structs.h
··· 1412 1412 /* The next stream in line */ 1413 1413 struct sctp_stream_out_ext *next; 1414 1414 __u16 prio; 1415 + __u16 users; 1415 1416 }; 1416 1417 1417 1418 struct sctp_stream_out_ext {
+1 -1
include/uapi/linux/netdev.h
··· 19 19 * @NETDEV_XDP_ACT_XSK_ZEROCOPY: This feature informs if netdev supports AF_XDP 20 20 * in zero copy mode. 21 21 * @NETDEV_XDP_ACT_HW_OFFLOAD: This feature informs if netdev supports XDP hw 22 - * oflloading. 22 + * offloading. 23 23 * @NETDEV_XDP_ACT_RX_SG: This feature informs if netdev implements non-linear 24 24 * XDP buffer support in the driver napi callback. 25 25 * @NETDEV_XDP_ACT_NDO_XMIT_SG: This feature informs if netdev implements
+1 -1
net/bridge/netfilter/ebtables.c
··· 1090 1090 1091 1091 audit_log_nfcfg(repl->name, AF_BRIDGE, repl->nentries, 1092 1092 AUDIT_XT_OP_REPLACE, GFP_KERNEL); 1093 - return ret; 1093 + return 0; 1094 1094 1095 1095 free_unlock: 1096 1096 mutex_unlock(&ebt_mutex);
+3 -1
net/core/dev.c
··· 3134 3134 { 3135 3135 if (in_hardirq() || irqs_disabled()) 3136 3136 __dev_kfree_skb_irq(skb, reason); 3137 + else if (unlikely(reason == SKB_REASON_DROPPED)) 3138 + kfree_skb(skb); 3137 3139 else 3138 - dev_kfree_skb(skb); 3140 + consume_skb(skb); 3139 3141 } 3140 3142 EXPORT_SYMBOL(__dev_kfree_skb_any); 3141 3143
+4
net/ipv4/netfilter/arp_tables.c
··· 1525 1525 1526 1526 new_table = xt_register_table(net, table, &bootstrap, newinfo); 1527 1527 if (IS_ERR(new_table)) { 1528 + struct arpt_entry *iter; 1529 + 1530 + xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) 1531 + cleanup_entry(iter, net); 1528 1532 xt_free_table_info(newinfo); 1529 1533 return PTR_ERR(new_table); 1530 1534 }
+5 -2
net/ipv4/netfilter/ip_tables.c
··· 1045 1045 struct xt_counters *counters; 1046 1046 struct ipt_entry *iter; 1047 1047 1048 - ret = 0; 1049 1048 counters = xt_counters_alloc(num_counters); 1050 1049 if (!counters) { 1051 1050 ret = -ENOMEM; ··· 1090 1091 net_warn_ratelimited("iptables: counters copy to user failed while replacing table\n"); 1091 1092 } 1092 1093 vfree(counters); 1093 - return ret; 1094 + return 0; 1094 1095 1095 1096 put_module: 1096 1097 module_put(t->me); ··· 1741 1742 1742 1743 new_table = xt_register_table(net, table, &bootstrap, newinfo); 1743 1744 if (IS_ERR(new_table)) { 1745 + struct ipt_entry *iter; 1746 + 1747 + xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) 1748 + cleanup_entry(iter, net); 1744 1749 xt_free_table_info(newinfo); 1745 1750 return PTR_ERR(new_table); 1746 1751 }
+5 -2
net/ipv4/tcp_minisocks.c
··· 597 597 * validation and inside tcp_v4_reqsk_send_ack(). Can we do better? 598 598 * 599 599 * We don't need to initialize tmp_opt.sack_ok as we don't use the results 600 + * 601 + * Note: If @fastopen is true, this can be called from process context. 602 + * Otherwise, this is from BH context. 600 603 */ 601 604 602 605 struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, ··· 751 748 &tcp_rsk(req)->last_oow_ack_time)) 752 749 req->rsk_ops->send_ack(sk, skb, req); 753 750 if (paws_reject) 754 - __NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED); 751 + NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED); 755 752 return NULL; 756 753 } 757 754 ··· 770 767 * "fourth, check the SYN bit" 771 768 */ 772 769 if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN)) { 773 - __TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS); 770 + TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS); 774 771 goto embryonic_reset; 775 772 } 776 773
+5 -2
net/ipv6/netfilter/ip6_tables.c
··· 1062 1062 struct xt_counters *counters; 1063 1063 struct ip6t_entry *iter; 1064 1064 1065 - ret = 0; 1066 1065 counters = xt_counters_alloc(num_counters); 1067 1066 if (!counters) { 1068 1067 ret = -ENOMEM; ··· 1107 1108 net_warn_ratelimited("ip6tables: counters copy to user failed while replacing table\n"); 1108 1109 } 1109 1110 vfree(counters); 1110 - return ret; 1111 + return 0; 1111 1112 1112 1113 put_module: 1113 1114 module_put(t->me); ··· 1750 1751 1751 1752 new_table = xt_register_table(net, table, &bootstrap, newinfo); 1752 1753 if (IS_ERR(new_table)) { 1754 + struct ip6t_entry *iter; 1755 + 1756 + xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) 1757 + cleanup_entry(iter, net); 1753 1758 xt_free_table_info(newinfo); 1754 1759 return PTR_ERR(new_table); 1755 1760 }
+3 -1
net/ipv6/netfilter/ip6t_rpfilter.c
··· 72 72 goto out; 73 73 } 74 74 75 - if (rt->rt6i_idev->dev == dev || (flags & XT_RPFILTER_LOOSE)) 75 + if (rt->rt6i_idev->dev == dev || 76 + l3mdev_master_ifindex_rcu(rt->rt6i_idev->dev) == dev->ifindex || 77 + (flags & XT_RPFILTER_LOOSE)) 76 78 ret = true; 77 79 out: 78 80 ip6_rt_put(rt);
+6 -5
net/ipv6/route.c
··· 5533 5533 nexthop_for_each_fib6_nh(f6i->nh, rt6_nh_nlmsg_size, 5534 5534 &nexthop_len); 5535 5535 } else { 5536 + struct fib6_info *sibling, *next_sibling; 5536 5537 struct fib6_nh *nh = f6i->fib6_nh; 5537 5538 5538 5539 nexthop_len = 0; 5539 5540 if (f6i->fib6_nsiblings) { 5540 - nexthop_len = nla_total_size(0) /* RTA_MULTIPATH */ 5541 - + NLA_ALIGN(sizeof(struct rtnexthop)) 5542 - + nla_total_size(16) /* RTA_GATEWAY */ 5543 - + lwtunnel_get_encap_size(nh->fib_nh_lws); 5541 + rt6_nh_nlmsg_size(nh, &nexthop_len); 5544 5542 5545 - nexthop_len *= f6i->fib6_nsiblings; 5543 + list_for_each_entry_safe(sibling, next_sibling, 5544 + &f6i->fib6_siblings, fib6_siblings) { 5545 + rt6_nh_nlmsg_size(sibling->fib6_nh, &nexthop_len); 5546 + } 5546 5547 } 5547 5548 nexthop_len += lwtunnel_get_encap_size(nh->fib_nh_lws); 5548 5549 }
+3
net/netfilter/core.c
··· 669 669 EXPORT_SYMBOL_GPL(nf_ct_hook); 670 670 671 671 #if IS_ENABLED(CONFIG_NF_CONNTRACK) 672 + u8 nf_ctnetlink_has_listener; 673 + EXPORT_SYMBOL_GPL(nf_ctnetlink_has_listener); 674 + 672 675 const struct nf_nat_hook __rcu *nf_nat_hook __read_mostly; 673 676 EXPORT_SYMBOL_GPL(nf_nat_hook); 674 677
-1
net/netfilter/nf_conntrack_bpf.c
··· 381 381 struct nf_conn *nfct = (struct nf_conn *)nfct_i; 382 382 int err; 383 383 384 - nfct->status |= IPS_CONFIRMED; 385 384 err = nf_conntrack_hash_check_insert(nfct); 386 385 if (err < 0) { 387 386 nf_conntrack_free(nfct);
+15 -10
net/netfilter/nf_conntrack_core.c
··· 884 884 885 885 zone = nf_ct_zone(ct); 886 886 887 - if (!nf_ct_ext_valid_pre(ct->ext)) { 888 - NF_CT_STAT_INC_ATOMIC(net, insert_failed); 889 - return -ETIMEDOUT; 890 - } 887 + if (!nf_ct_ext_valid_pre(ct->ext)) 888 + return -EAGAIN; 891 889 892 890 local_bh_disable(); 893 891 do { ··· 920 922 goto chaintoolong; 921 923 } 922 924 925 + /* If genid has changed, we can't insert anymore because ct 926 + * extensions could have stale pointers and nf_ct_iterate_destroy 927 + * might have completed its table scan already. 928 + * 929 + * Increment of the ext genid right after this check is fine: 930 + * nf_ct_iterate_destroy blocks until locks are released. 931 + */ 932 + if (!nf_ct_ext_valid_post(ct->ext)) { 933 + err = -EAGAIN; 934 + goto out; 935 + } 936 + 937 + ct->status |= IPS_CONFIRMED; 923 938 smp_wmb(); 924 939 /* The caller holds a reference to this object */ 925 940 refcount_set(&ct->ct_general.use, 2); ··· 940 929 nf_conntrack_double_unlock(hash, reply_hash); 941 930 NF_CT_STAT_INC(net, insert); 942 931 local_bh_enable(); 943 - 944 - if (!nf_ct_ext_valid_post(ct->ext)) { 945 - nf_ct_kill(ct); 946 - NF_CT_STAT_INC_ATOMIC(net, drop); 947 - return -ETIMEDOUT; 948 - } 949 932 950 933 return 0; 951 934 chaintoolong:
+1 -1
net/netfilter/nf_conntrack_ecache.c
··· 309 309 break; 310 310 return true; 311 311 case 2: /* autodetect: no event listener, don't allocate extension. */ 312 - if (!READ_ONCE(net->ct.ctnetlink_has_listener)) 312 + if (!READ_ONCE(nf_ctnetlink_has_listener)) 313 313 return true; 314 314 fallthrough; 315 315 case 1:
+4 -4
net/netfilter/nf_conntrack_netlink.c
··· 2316 2316 nfct_seqadj_ext_add(ct); 2317 2317 nfct_synproxy_ext_add(ct); 2318 2318 2319 - /* we must add conntrack extensions before confirmation. */ 2320 - ct->status |= IPS_CONFIRMED; 2321 - 2322 2319 if (cda[CTA_STATUS]) { 2323 2320 err = ctnetlink_change_status(ct, cda); 2324 2321 if (err < 0) ··· 2372 2375 2373 2376 err = nf_conntrack_hash_check_insert(ct); 2374 2377 if (err < 0) 2375 - goto err2; 2378 + goto err3; 2376 2379 2377 2380 rcu_read_unlock(); 2378 2381 2379 2382 return ct; 2380 2383 2384 + err3: 2385 + if (ct->master) 2386 + nf_ct_put(ct->master); 2381 2387 err2: 2382 2388 rcu_read_unlock(); 2383 2389 err1:
+1 -1
net/netfilter/nf_tables_api.c
··· 5507 5507 int rem, err = 0; 5508 5508 5509 5509 table = nft_table_lookup(net, nla[NFTA_SET_ELEM_LIST_TABLE], family, 5510 - genmask, NETLINK_CB(skb).portid); 5510 + genmask, 0); 5511 5511 if (IS_ERR(table)) { 5512 5512 NL_SET_BAD_ATTR(extack, nla[NFTA_SET_ELEM_LIST_TABLE]); 5513 5513 return PTR_ERR(table);
+5 -4
net/netfilter/nfnetlink.c
··· 29 29 30 30 #include <net/netlink.h> 31 31 #include <net/netns/generic.h> 32 + #include <linux/netfilter.h> 32 33 #include <linux/netfilter/nfnetlink.h> 33 34 34 35 MODULE_LICENSE("GPL"); ··· 686 685 group_bit = (1 << group); 687 686 688 687 spin_lock(&nfnl_grp_active_lock); 689 - v = READ_ONCE(net->ct.ctnetlink_has_listener); 688 + v = READ_ONCE(nf_ctnetlink_has_listener); 690 689 if ((v & group_bit) == 0) { 691 690 v |= group_bit; 692 691 693 692 /* read concurrently without nfnl_grp_active_lock held. */ 694 - WRITE_ONCE(net->ct.ctnetlink_has_listener, v); 693 + WRITE_ONCE(nf_ctnetlink_has_listener, v); 695 694 } 696 695 697 696 spin_unlock(&nfnl_grp_active_lock); ··· 745 744 746 745 spin_lock(&nfnl_grp_active_lock); 747 746 if (!nfnetlink_has_listeners(net, group)) { 748 - u8 v = READ_ONCE(net->ct.ctnetlink_has_listener); 747 + u8 v = READ_ONCE(nf_ctnetlink_has_listener); 749 748 750 749 v &= ~group_bit; 751 750 752 751 /* read concurrently without nfnl_grp_active_lock held. */ 753 - WRITE_ONCE(net->ct.ctnetlink_has_listener, v); 752 + WRITE_ONCE(nf_ctnetlink_has_listener, v); 754 753 } 755 754 spin_unlock(&nfnl_grp_active_lock); 756 755 #endif
+1 -2
net/netfilter/xt_length.c
··· 30 30 length_mt6(const struct sk_buff *skb, struct xt_action_param *par) 31 31 { 32 32 const struct xt_length_info *info = par->matchinfo; 33 - const u_int16_t pktlen = ntohs(ipv6_hdr(skb)->payload_len) + 34 - sizeof(struct ipv6hdr); 33 + u32 pktlen = skb->len; 35 34 36 35 return (pktlen >= info->min && pktlen <= info->max) ^ info->invert; 37 36 }
+4
net/nfc/netlink.c
··· 1442 1442 rc = dev->ops->se_io(dev, se_idx, apdu, 1443 1443 apdu_length, cb, cb_context); 1444 1444 1445 + device_unlock(&dev->dev); 1446 + return rc; 1447 + 1445 1448 error: 1449 + kfree(cb_context); 1446 1450 device_unlock(&dev->dev); 1447 1451 return rc; 1448 1452 }
+2 -2
net/sched/act_api.c
··· 1596 1596 if (tcf_action_dump(skb, actions, bind, ref, false) < 0) 1597 1597 goto out_nlmsg_trim; 1598 1598 1599 - nla_nest_end(skb, nest); 1600 - 1601 1599 if (extack && extack->_msg && 1602 1600 nla_put_string(skb, TCA_EXT_WARN_MSG, extack->_msg)) 1603 1601 goto out_nlmsg_trim; 1602 + 1603 + nla_nest_end(skb, nest); 1604 1604 1605 1605 nlh->nlmsg_len = skb_tail_pointer(skb) - b; 1606 1606
+37 -29
net/sched/act_mpls.c
··· 190 190 parm = nla_data(tb[TCA_MPLS_PARMS]); 191 191 index = parm->index; 192 192 193 + err = tcf_idr_check_alloc(tn, &index, a, bind); 194 + if (err < 0) 195 + return err; 196 + exists = err; 197 + if (exists && bind) 198 + return 0; 199 + 200 + if (!exists) { 201 + ret = tcf_idr_create(tn, index, est, a, &act_mpls_ops, bind, 202 + true, flags); 203 + if (ret) { 204 + tcf_idr_cleanup(tn, index); 205 + return ret; 206 + } 207 + 208 + ret = ACT_P_CREATED; 209 + } else if (!(flags & TCA_ACT_FLAGS_REPLACE)) { 210 + tcf_idr_release(*a, bind); 211 + return -EEXIST; 212 + } 213 + 193 214 /* Verify parameters against action type. */ 194 215 switch (parm->m_action) { 195 216 case TCA_MPLS_ACT_POP: 196 217 if (!tb[TCA_MPLS_PROTO]) { 197 218 NL_SET_ERR_MSG_MOD(extack, "Protocol must be set for MPLS pop"); 198 - return -EINVAL; 219 + err = -EINVAL; 220 + goto release_idr; 199 221 } 200 222 if (!eth_proto_is_802_3(nla_get_be16(tb[TCA_MPLS_PROTO]))) { 201 223 NL_SET_ERR_MSG_MOD(extack, "Invalid protocol type for MPLS pop"); 202 - return -EINVAL; 224 + err = -EINVAL; 225 + goto release_idr; 203 226 } 204 227 if (tb[TCA_MPLS_LABEL] || tb[TCA_MPLS_TTL] || tb[TCA_MPLS_TC] || 205 228 tb[TCA_MPLS_BOS]) { 206 229 NL_SET_ERR_MSG_MOD(extack, "Label, TTL, TC or BOS cannot be used with MPLS pop"); 207 - return -EINVAL; 230 + err = -EINVAL; 231 + goto release_idr; 208 232 } 209 233 break; 210 234 case TCA_MPLS_ACT_DEC_TTL: 211 235 if (tb[TCA_MPLS_PROTO] || tb[TCA_MPLS_LABEL] || 212 236 tb[TCA_MPLS_TTL] || tb[TCA_MPLS_TC] || tb[TCA_MPLS_BOS]) { 213 237 NL_SET_ERR_MSG_MOD(extack, "Label, TTL, TC, BOS or protocol cannot be used with MPLS dec_ttl"); 214 - return -EINVAL; 238 + err = -EINVAL; 239 + goto release_idr; 215 240 } 216 241 break; 217 242 case TCA_MPLS_ACT_PUSH: 218 243 case TCA_MPLS_ACT_MAC_PUSH: 219 244 if (!tb[TCA_MPLS_LABEL]) { 220 245 NL_SET_ERR_MSG_MOD(extack, "Label is required for MPLS push"); 221 - return -EINVAL; 246 + err = -EINVAL; 247 + goto release_idr; 222 248 } 223 249 if (tb[TCA_MPLS_PROTO] && 224 250 !eth_p_mpls(nla_get_be16(tb[TCA_MPLS_PROTO]))) { 225 251 NL_SET_ERR_MSG_MOD(extack, "Protocol must be an MPLS type for MPLS push"); 226 - return -EPROTONOSUPPORT; 252 + err = -EPROTONOSUPPORT; 253 + goto release_idr; 227 254 } 228 255 /* Push needs a TTL - if not specified, set a default value. */ 229 256 if (!tb[TCA_MPLS_TTL]) { ··· 265 238 case TCA_MPLS_ACT_MODIFY: 266 239 if (tb[TCA_MPLS_PROTO]) { 267 240 NL_SET_ERR_MSG_MOD(extack, "Protocol cannot be used with MPLS modify"); 268 - return -EINVAL; 241 + err = -EINVAL; 242 + goto release_idr; 269 243 } 270 244 break; 271 245 default: 272 246 NL_SET_ERR_MSG_MOD(extack, "Unknown MPLS action"); 273 - return -EINVAL; 274 - } 275 - 276 - err = tcf_idr_check_alloc(tn, &index, a, bind); 277 - if (err < 0) 278 - return err; 279 - exists = err; 280 - if (exists && bind) 281 - return 0; 282 - 283 - if (!exists) { 284 - ret = tcf_idr_create(tn, index, est, a, 285 - &act_mpls_ops, bind, true, flags); 286 - if (ret) { 287 - tcf_idr_cleanup(tn, index); 288 - return ret; 289 - } 290 - 291 - ret = ACT_P_CREATED; 292 - } else if (!(flags & TCA_ACT_FLAGS_REPLACE)) { 293 - tcf_idr_release(*a, bind); 294 - return -EEXIST; 247 + err = -EINVAL; 248 + goto release_idr; 295 249 } 296 250 297 251 err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
+31 -27
net/sched/act_pedit.c
··· 181 181 } 182 182 183 183 parm = nla_data(pattr); 184 - if (!parm->nkeys) { 185 - NL_SET_ERR_MSG_MOD(extack, "Pedit requires keys to be passed"); 186 - return -EINVAL; 187 - } 188 - ksize = parm->nkeys * sizeof(struct tc_pedit_key); 189 - if (nla_len(pattr) < sizeof(*parm) + ksize) { 190 - NL_SET_ERR_MSG_ATTR(extack, pattr, "Length of TCA_PEDIT_PARMS or TCA_PEDIT_PARMS_EX pedit attribute is invalid"); 191 - return -EINVAL; 192 - } 193 - 194 - nparms = kzalloc(sizeof(*nparms), GFP_KERNEL); 195 - if (!nparms) 196 - return -ENOMEM; 197 - 198 - nparms->tcfp_keys_ex = 199 - tcf_pedit_keys_ex_parse(tb[TCA_PEDIT_KEYS_EX], parm->nkeys); 200 - if (IS_ERR(nparms->tcfp_keys_ex)) { 201 - ret = PTR_ERR(nparms->tcfp_keys_ex); 202 - goto out_free; 203 - } 204 184 205 185 index = parm->index; 206 186 err = tcf_idr_check_alloc(tn, &index, a, bind); ··· 189 209 &act_pedit_ops, bind, flags); 190 210 if (ret) { 191 211 tcf_idr_cleanup(tn, index); 192 - goto out_free_ex; 212 + return ret; 193 213 } 194 214 ret = ACT_P_CREATED; 195 215 } else if (err > 0) { 196 216 if (bind) 197 - goto out_free; 217 + return 0; 198 218 if (!(flags & TCA_ACT_FLAGS_REPLACE)) { 199 219 ret = -EEXIST; 200 220 goto out_release; 201 221 } 202 222 } else { 203 - ret = err; 204 - goto out_free_ex; 223 + return err; 224 + } 225 + 226 + if (!parm->nkeys) { 227 + NL_SET_ERR_MSG_MOD(extack, "Pedit requires keys to be passed"); 228 + ret = -EINVAL; 229 + goto out_release; 230 + } 231 + ksize = parm->nkeys * sizeof(struct tc_pedit_key); 232 + if (nla_len(pattr) < sizeof(*parm) + ksize) { 233 + NL_SET_ERR_MSG_ATTR(extack, pattr, "Length of TCA_PEDIT_PARMS or TCA_PEDIT_PARMS_EX pedit attribute is invalid"); 234 + ret = -EINVAL; 235 + goto out_release; 236 + } 237 + 238 + nparms = kzalloc(sizeof(*nparms), GFP_KERNEL); 239 + if (!nparms) { 240 + ret = -ENOMEM; 241 + goto out_release; 242 + } 243 + 244 + nparms->tcfp_keys_ex = 245 + tcf_pedit_keys_ex_parse(tb[TCA_PEDIT_KEYS_EX], parm->nkeys); 246 + if (IS_ERR(nparms->tcfp_keys_ex)) { 247 + ret = PTR_ERR(nparms->tcfp_keys_ex); 248 + goto out_free; 205 249 } 206 250 207 251 err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack); 208 252 if (err < 0) { 209 253 ret = err; 210 - goto out_release; 254 + goto out_free_ex; 211 255 } 212 256 213 257 nparms->tcfp_off_max_hint = 0; ··· 282 278 put_chain: 283 279 if (goto_ch) 284 280 tcf_chain_put_by_act(goto_ch); 285 - out_release: 286 - tcf_idr_release(*a, bind); 287 281 out_free_ex: 288 282 kfree(nparms->tcfp_keys_ex); 289 283 out_free: 290 284 kfree(nparms); 285 + out_release: 286 + tcf_idr_release(*a, bind); 291 287 return ret; 292 288 } 293 289
+9 -2
net/sched/act_sample.c
··· 55 55 sample_policy, NULL); 56 56 if (ret < 0) 57 57 return ret; 58 - if (!tb[TCA_SAMPLE_PARMS] || !tb[TCA_SAMPLE_RATE] || 59 - !tb[TCA_SAMPLE_PSAMPLE_GROUP]) 58 + 59 + if (!tb[TCA_SAMPLE_PARMS]) 60 60 return -EINVAL; 61 61 62 62 parm = nla_data(tb[TCA_SAMPLE_PARMS]); ··· 80 80 tcf_idr_release(*a, bind); 81 81 return -EEXIST; 82 82 } 83 + 84 + if (!tb[TCA_SAMPLE_RATE] || !tb[TCA_SAMPLE_PSAMPLE_GROUP]) { 85 + NL_SET_ERR_MSG(extack, "sample rate and group are required"); 86 + err = -EINVAL; 87 + goto release_idr; 88 + } 89 + 83 90 err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack); 84 91 if (err < 0) 85 92 goto release_idr;
+1 -1
net/sched/cls_api.c
··· 3241 3241 3242 3242 void tcf_exts_destroy(struct tcf_exts *exts) 3243 3243 { 3244 - #ifdef CONFIG_NET_CLS_ACT 3245 3244 tcf_exts_miss_cookie_base_destroy(exts); 3246 3245 3246 + #ifdef CONFIG_NET_CLS_ACT 3247 3247 if (exts->actions) { 3248 3248 tcf_action_destroy(exts->actions, TCA_ACT_UNBIND); 3249 3249 kfree(exts->actions);
+21 -31
net/sctp/stream_sched_prio.c
··· 25 25 26 26 static void sctp_sched_prio_unsched_all(struct sctp_stream *stream); 27 27 28 + static struct sctp_stream_priorities *sctp_sched_prio_head_get(struct sctp_stream_priorities *p) 29 + { 30 + p->users++; 31 + return p; 32 + } 33 + 34 + static void sctp_sched_prio_head_put(struct sctp_stream_priorities *p) 35 + { 36 + if (p && --p->users == 0) 37 + kfree(p); 38 + } 39 + 28 40 static struct sctp_stream_priorities *sctp_sched_prio_new_head( 29 41 struct sctp_stream *stream, int prio, gfp_t gfp) 30 42 { ··· 50 38 INIT_LIST_HEAD(&p->active); 51 39 p->next = NULL; 52 40 p->prio = prio; 41 + p->users = 1; 53 42 54 43 return p; 55 44 } ··· 66 53 */ 67 54 list_for_each_entry(p, &stream->prio_list, prio_sched) { 68 55 if (p->prio == prio) 69 - return p; 56 + return sctp_sched_prio_head_get(p); 70 57 if (p->prio > prio) 71 58 break; 72 59 } ··· 83 70 */ 84 71 break; 85 72 if (p->prio == prio) 86 - return p; 73 + return sctp_sched_prio_head_get(p); 87 74 } 88 75 89 76 /* If not even there, allocate a new one. */ ··· 167 154 struct sctp_stream_out_ext *soute = sout->ext; 168 155 struct sctp_stream_priorities *prio_head, *old; 169 156 bool reschedule = false; 170 - int i; 157 + 158 + old = soute->prio_head; 159 + if (old && old->prio == prio) 160 + return 0; 171 161 172 162 prio_head = sctp_sched_prio_get_head(stream, prio, gfp); 173 163 if (!prio_head) 174 164 return -ENOMEM; 175 165 176 166 reschedule = sctp_sched_prio_unsched(soute); 177 - old = soute->prio_head; 178 167 soute->prio_head = prio_head; 179 168 if (reschedule) 180 169 sctp_sched_prio_sched(stream, soute); 181 170 182 - if (!old) 183 - /* Happens when we set the priority for the first time */ 184 - return 0; 185 - 186 - for (i = 0; i < stream->outcnt; i++) { 187 - soute = SCTP_SO(stream, i)->ext; 188 - if (soute && soute->prio_head == old) 189 - /* It's still in use, nothing else to do here. */ 190 - return 0; 191 - } 192 - 193 - /* No hits, we are good to free it. */ 194 - kfree(old); 195 - 171 + sctp_sched_prio_head_put(old); 196 172 return 0; 197 173 } 198 174 ··· 208 206 209 207 static void sctp_sched_prio_free_sid(struct sctp_stream *stream, __u16 sid) 210 208 { 211 - struct sctp_stream_priorities *prio = SCTP_SO(stream, sid)->ext->prio_head; 212 - int i; 213 - 214 - if (!prio) 215 - return; 216 - 209 + sctp_sched_prio_head_put(SCTP_SO(stream, sid)->ext->prio_head); 217 210 SCTP_SO(stream, sid)->ext->prio_head = NULL; 218 - for (i = 0; i < stream->outcnt; i++) { 219 - if (SCTP_SO(stream, i)->ext && 220 - SCTP_SO(stream, i)->ext->prio_head == prio) 221 - return; 222 - } 223 - 224 - kfree(prio); 225 211 } 226 212 227 213 static void sctp_sched_prio_enqueue(struct sctp_outq *q,
+2 -2
net/wireless/wext-core.c
··· 641 641 { 642 642 char name[sizeof(current->comm)]; 643 643 644 - pr_warn_ratelimited("warning: `%s' uses wireless extensions that are deprecated for modern drivers; use nl80211\n", 645 - get_task_comm(name, current)); 644 + pr_warn_once("warning: `%s' uses wireless extensions which will stop working for Wi-Fi 7 hardware; use nl80211\n", 645 + get_task_comm(name, current)); 646 646 } 647 647 #endif 648 648
+1 -1
tools/include/uapi/linux/netdev.h
··· 19 19 * @NETDEV_XDP_ACT_XSK_ZEROCOPY: This feature informs if netdev supports AF_XDP 20 20 * in zero copy mode. 21 21 * @NETDEV_XDP_ACT_HW_OFFLOAD: This feature informs if netdev supports XDP hw 22 - * oflloading. 22 + * offloading. 23 23 * @NETDEV_XDP_ACT_RX_SG: This feature informs if netdev implements non-linear 24 24 * XDP buffer support in the driver napi callback. 25 25 * @NETDEV_XDP_ACT_NDO_XMIT_SG: This feature informs if netdev implements
+1
tools/net/ynl/lib/.gitignore
··· 1 + __pycache__/
+1 -3
tools/net/ynl/lib/nlspec.py
··· 3 3 import collections 4 4 import importlib 5 5 import os 6 - import traceback 7 6 import yaml 8 7 9 8 ··· 233 234 resolved.append(elem) 234 235 235 236 if len(resolved) == 0: 236 - traceback.print_exception(last_exception) 237 - raise Exception("Could not resolve any spec element, infinite loop?") 237 + raise last_exception 238 238 239 239 def new_attr_set(self, elem): 240 240 return SpecAttrSet(self, elem)
+1 -1
tools/net/ynl/ynl-gen-c.py
··· 546 546 max_val = 0 547 547 self.attr_max_val = None 548 548 for name, attr in self.attr_list: 549 - if attr.value > max_val: 549 + if attr.value >= max_val: 550 550 max_val = attr.value 551 551 self.attr_max_val = attr 552 552 self.attrs[name] = attr
+95 -1
tools/testing/selftests/net/fib_tests.sh
··· 9 9 ksft_skip=4 10 10 11 11 # all tests in this script. Can be overridden with -t option 12 - TESTS="unregister down carrier nexthop suppress ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric ipv6_route_metrics ipv4_route_metrics ipv4_route_v6_gw rp_filter ipv4_del_addr ipv4_mangle ipv6_mangle ipv4_bcast_neigh" 12 + TESTS="unregister down carrier nexthop suppress ipv6_notify ipv4_notify ipv6_rt ipv4_rt ipv6_addr_metric ipv4_addr_metric ipv6_route_metrics ipv4_route_metrics ipv4_route_v6_gw rp_filter ipv4_del_addr ipv4_mangle ipv6_mangle ipv4_bcast_neigh" 13 13 14 14 VERBOSE=0 15 15 PAUSE_ON_FAIL=no ··· 653 653 $IP link del red 654 654 ) 2>/dev/null 655 655 cleanup 656 + } 657 + 658 + fib6_notify_test() 659 + { 660 + setup 661 + 662 + echo 663 + echo "Fib6 info length calculation in route notify test" 664 + set -e 665 + 666 + for i in 10 20 30 40 50 60 70; 667 + do 668 + $IP link add dummy_$i type dummy 669 + $IP link set dev dummy_$i up 670 + $IP -6 address add 2001:$i::1/64 dev dummy_$i 671 + done 672 + 673 + $NS_EXEC ip monitor route &> errors.txt & 674 + sleep 2 675 + 676 + $IP -6 route add 2001::/64 \ 677 + nexthop via 2001:10::2 dev dummy_10 \ 678 + nexthop encap ip6 dst 2002::20 via 2001:20::2 dev dummy_20 \ 679 + nexthop encap ip6 dst 2002::30 via 2001:30::2 dev dummy_30 \ 680 + nexthop encap ip6 dst 2002::40 via 2001:40::2 dev dummy_40 \ 681 + nexthop encap ip6 dst 2002::50 via 2001:50::2 dev dummy_50 \ 682 + nexthop encap ip6 dst 2002::60 via 2001:60::2 dev dummy_60 \ 683 + nexthop encap ip6 dst 2002::70 via 2001:70::2 dev dummy_70 684 + 685 + set +e 686 + 687 + err=`cat errors.txt |grep "Message too long"` 688 + if [ -z "$err" ];then 689 + ret=0 690 + else 691 + ret=1 692 + fi 693 + 694 + log_test $ret 0 "ipv6 route add notify" 695 + 696 + { kill %% && wait %%; } 2>/dev/null 697 + 698 + #rm errors.txt 699 + 700 + cleanup &> /dev/null 701 + } 702 + 703 + 704 + fib_notify_test() 705 + { 706 + setup 707 + 708 + echo 709 + echo "Fib4 info length calculation in route notify test" 710 + 711 + set -e 712 + 713 + for i in 10 20 30 40 50 60 70; 714 + do 715 + $IP link add dummy_$i type dummy 716 + $IP link set dev dummy_$i up 717 + $IP address add 20.20.$i.2/24 dev dummy_$i 718 + done 719 + 720 + $NS_EXEC ip monitor route &> errors.txt & 721 + sleep 2 722 + 723 + $IP route add 10.0.0.0/24 \ 724 + nexthop via 20.20.10.1 dev dummy_10 \ 725 + nexthop encap ip dst 192.168.10.20 via 20.20.20.1 dev dummy_20 \ 726 + nexthop encap ip dst 192.168.10.30 via 20.20.30.1 dev dummy_30 \ 727 + nexthop encap ip dst 192.168.10.40 via 20.20.40.1 dev dummy_40 \ 728 + nexthop encap ip dst 192.168.10.50 via 20.20.50.1 dev dummy_50 \ 729 + nexthop encap ip dst 192.168.10.60 via 20.20.60.1 dev dummy_60 \ 730 + nexthop encap ip dst 192.168.10.70 via 20.20.70.1 dev dummy_70 731 + 732 + set +e 733 + 734 + err=`cat errors.txt |grep "Message too long"` 735 + if [ -z "$err" ];then 736 + ret=0 737 + else 738 + ret=1 739 + fi 740 + 741 + log_test $ret 0 "ipv4 route add notify" 742 + 743 + { kill %% && wait %%; } 2>/dev/null 744 + 745 + rm errors.txt 746 + 747 + cleanup &> /dev/null 656 748 } 657 749 658 750 fib_suppress_test() ··· 2203 2111 fib_carrier_test|carrier) fib_carrier_test;; 2204 2112 fib_rp_filter_test|rp_filter) fib_rp_filter_test;; 2205 2113 fib_nexthop_test|nexthop) fib_nexthop_test;; 2114 + fib_notify_test|ipv4_notify) fib_notify_test;; 2115 + fib6_notify_test|ipv6_notify) fib6_notify_test;; 2206 2116 fib_suppress_test|suppress) fib_suppress_test;; 2207 2117 ipv6_route_test|ipv6_rt) ipv6_route_test;; 2208 2118 ipv4_route_test|ipv4_rt) ipv4_route_test;;
+26 -6
tools/testing/selftests/netfilter/rpath.sh
··· 62 62 ip -net "$ns2" a a fec0:42::1/64 dev d0 nodad 63 63 64 64 # firewall matches to test 65 - [ -n "$iptables" ] && ip netns exec "$ns2" \ 66 - "$iptables" -t raw -A PREROUTING -s 192.168.0.0/16 -m rpfilter 67 - [ -n "$ip6tables" ] && ip netns exec "$ns2" \ 68 - "$ip6tables" -t raw -A PREROUTING -s fec0::/16 -m rpfilter 65 + [ -n "$iptables" ] && { 66 + common='-t raw -A PREROUTING -s 192.168.0.0/16' 67 + ip netns exec "$ns2" "$iptables" $common -m rpfilter 68 + ip netns exec "$ns2" "$iptables" $common -m rpfilter --invert 69 + } 70 + [ -n "$ip6tables" ] && { 71 + common='-t raw -A PREROUTING -s fec0::/16' 72 + ip netns exec "$ns2" "$ip6tables" $common -m rpfilter 73 + ip netns exec "$ns2" "$ip6tables" $common -m rpfilter --invert 74 + } 69 75 [ -n "$nft" ] && ip netns exec "$ns2" $nft -f - <<EOF 70 76 table inet t { 71 77 chain c { ··· 95 89 [ -n "$1" ] || return 0 96 90 ip netns exec "$ns2" "$1" -t raw -vS | grep -q -- "-m rpfilter -c 0 0" 97 91 } 92 + ipt_zero_reverse_rule() { # (command) 93 + [ -n "$1" ] || return 0 94 + ip netns exec "$ns2" "$1" -t raw -vS | \ 95 + grep -q -- "-m rpfilter --invert -c 0 0" 96 + } 98 97 nft_zero_rule() { # (family) 99 98 [ -n "$nft" ] || return 0 100 99 ip netns exec "$ns2" "$nft" list chain inet t c | \ ··· 112 101 ip netns exec "$netns" ping -q -c 1 -W 1 "$@" >/dev/null 113 102 } 114 103 115 - testrun() { 116 - # clear counters first 104 + clear_counters() { 117 105 [ -n "$iptables" ] && ip netns exec "$ns2" "$iptables" -t raw -Z 118 106 [ -n "$ip6tables" ] && ip netns exec "$ns2" "$ip6tables" -t raw -Z 119 107 if [ -n "$nft" ]; then ··· 121 111 ip netns exec "$ns2" $nft -s list table inet t; 122 112 ) | ip netns exec "$ns2" $nft -f - 123 113 fi 114 + } 115 + 116 + testrun() { 117 + clear_counters 124 118 125 119 # test 1: martian traffic should fail rpfilter matches 126 120 netns_ping "$ns1" -I v0 192.168.42.1 && \ ··· 134 120 135 121 ipt_zero_rule "$iptables" || die "iptables matched martian" 136 122 ipt_zero_rule "$ip6tables" || die "ip6tables matched martian" 123 + ipt_zero_reverse_rule "$iptables" && die "iptables not matched martian" 124 + ipt_zero_reverse_rule "$ip6tables" && die "ip6tables not matched martian" 137 125 nft_zero_rule ip || die "nft IPv4 matched martian" 138 126 nft_zero_rule ip6 || die "nft IPv6 matched martian" 127 + 128 + clear_counters 139 129 140 130 # test 2: rpfilter match should pass for regular traffic 141 131 netns_ping "$ns1" 192.168.23.1 || \ ··· 149 131 150 132 ipt_zero_rule "$iptables" && die "iptables match not effective" 151 133 ipt_zero_rule "$ip6tables" && die "ip6tables match not effective" 134 + ipt_zero_reverse_rule "$iptables" || die "iptables match over-effective" 135 + ipt_zero_reverse_rule "$ip6tables" || die "ip6tables match over-effective" 152 136 nft_zero_rule ip && die "nft IPv4 match not effective" 153 137 nft_zero_rule ip6 && die "nft IPv6 match not effective" 154 138