linux/drivers/net/ethernet/mellanox/mlxsw
Petr Machata 7ea07afb23 mlxsw: spectrum_flower: Fix port range register leak in tmplt_create()
mlxsw_sp_flower_tmplt_create() parses a flow_cls_offload template
into a stack-local struct mlxsw_sp_acl_rule_info purely to compute
rulei.values.elusage. Parsing can acquire port range registers via
mlxsw_sp_flower_parse_ports_range(), but since this rulei never goes
through mlxsw_sp_acl_rulei_destroy(), those registers were never
released, including through chain template deletion.

Factor out of mlxsw_sp_acl_rulei_destroy() the code to actually
release the necessary resources and call from
mlxsw_sp_flower_tmplt_create() to plug the leak.

The issue was found during a review of Wentao Liang's patch referenced
below.

Fixes: fe22f74105 ("mlxsw: spectrum_flower: Add ability to match on port ranges")
Reported-by: Wentao Liang <vulab@iscas.ac.cn>
Closes: https://lore.kernel.org/netdev/20260917113236.2149095-1-vulab@iscas.ac.cn/
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/95339cf970ce78e1a74aa86ffcc104ecf7c7762c.1791294384.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-10-08 10:49:24 -07:00
..
cmd.h
core_acl_flex_actions.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
core_acl_flex_actions.h
core_acl_flex_keys.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
core_acl_flex_keys.h mlxsw: spectrum_acl_flex_keys: Constify struct mlxsw_afk_element_inst 2024-10-07 16:35:03 -07:00
core_env.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
core_env.h mlxsw: Implement ethtool operation to write to a transceiver module EEPROM 2024-06-28 10:48:22 +01:00
core_hwmon.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
core_linecard_dev.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
core_linecards.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
core_thermal.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
core.c devlink: pass param values by pointer 2026-05-25 14:03:06 -07:00
core.h mlxsw: Do not store Tx header length as driver parameter 2025-01-17 19:58:00 -08:00
emad.h
i2c.c Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
i2c.h
item.h mlxsw: Warn about invalid accesses to array fields 2024-07-09 18:46:44 -07:00
Kconfig ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs 2026-03-29 11:21:22 -07:00
Makefile
minimal.c Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
pci_hw.h mlxsw: Enable Tx checksum offload 2025-02-10 19:10:51 -08:00
pci.c mlxsw: pci: Don't store pci_device_id 2026-07-28 11:17:20 -05:00
pci.h
port.h mlxsw: Adjust MTU value to hardware check 2024-06-14 19:30:34 -07:00
reg.h mlxsw: spectrum_ethtool: expose per-PG rx_discards 2026-05-20 17:08:00 -07:00
resources.h
spectrum_acl_atcam.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_acl_bloom_filter.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
spectrum_acl_ctcam.c
spectrum_acl_erp.c mlxsw: spectrum_acl_erp: Fix const qualifier of delta_clear() 2026-06-29 17:45:19 -07:00
spectrum_acl_flex_actions.c
spectrum_acl_flex_actions.h
spectrum_acl_flex_keys.c mlxsw: spectrum_acl_flex_keys: Use correct key block on Spectrum-4 2024-12-04 19:18:35 -08:00
spectrum_acl_tcam.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_acl_tcam.h mlxsw: spectrum_acl_erp: Fix const qualifier of delta_clear() 2026-06-29 17:45:19 -07:00
spectrum_acl.c mlxsw: spectrum_flower: Fix port range register leak in tmplt_create() 2026-10-08 10:49:24 -07:00
spectrum_buffers.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
spectrum_cnt.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_cnt.h
spectrum_dcb.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
spectrum_dpipe.c mlxsw: spectrum_router: Constify struct devlink_dpipe_table_ops 2024-06-05 10:24:57 +01:00
spectrum_dpipe.h
spectrum_ethtool.c mlxsw: ethtool: Prepare for RTNL-less ethtool operations 2026-07-21 12:43:44 +02:00
spectrum_fid.c mlxsw: spectrum_fid: use a dedicated list head pointer for sorted insert 2026-05-26 18:03:46 -07:00
spectrum_flow.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_flower.c mlxsw: spectrum_flower: Fix port range register leak in tmplt_create() 2026-10-08 10:49:24 -07:00
spectrum_ipip.c mlxsw: spectrum_ipip: Fix memory leak when changing remote IPv6 address 2024-10-30 18:24:39 -07:00
spectrum_ipip.h
spectrum_kvdl.c
spectrum_matchall.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_mr_tcam.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_mr_tcam.h
spectrum_mr.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_mr.h
spectrum_nve_vxlan.c
spectrum_nve.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
spectrum_nve.h
spectrum_pgt.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_policer.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_port_range.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_ptp.c mlxsw: spectrum_ptp: Fix napi_gro_receive() call from GC workqueue context 2026-09-03 17:01:03 -07:00
spectrum_ptp.h net: mlxsw: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set() 2025-05-13 16:38:25 -07:00
spectrum_qdisc.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
spectrum_router.c mlxsw: fix refcount leak in mlxsw_sp_vrs_lpm_tree_replace() 2026-06-11 15:49:33 -07:00
spectrum_router.h mlxsw: spectrum_router: Remove unused functions 2025-02-04 14:05:53 -08:00
spectrum_span.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_span.h
spectrum_switchdev.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum_switchdev.h
spectrum_trap.c mlxsw: Trap ARP packets at layer 2 instead of layer 3 2025-03-24 15:09:30 -07:00
spectrum_trap.h
spectrum.c mlxsw: Tell the core to use the netdev instance lock 2026-07-21 12:43:44 +02:00
spectrum.h mlxsw: spectrum_flower: Fix port range register leak in tmplt_create() 2026-10-08 10:49:24 -07:00
spectrum1_acl_tcam.c
spectrum1_kvdl.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spectrum1_mr_tcam.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
spectrum2_acl_tcam.c
spectrum2_kvdl.c
spectrum2_mr_tcam.c
trap.h mlxsw: spectrum: Forward packets with an IPv4 link-local source IP 2025-08-15 10:44:48 -07:00
txheader.h mlxsw: Define Tx header fields in txheader.h 2025-01-17 19:58:00 -08:00