diff options
| author | Cosmin Ratiu <cratiu@nvidia.com> | 2026-11-05 23:16:30 +0200 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-11-10 15:33:08 -0800 |
| commit | b102f927c69e2d7cf849bcfb7f7b0cd6e52fc1b0 (patch) | |
| tree | 6d182d78e1428a51c20520b3e9a0497a18b5b2c6 /tools/perf/scripts/python | |
| parent | e8303b58108519ff103241442c0a7602fa106af5 (diff) | |
net/mlx5e: Serialize ipsec encap reservations with eswitch operations
mlx5_eswitch_block_encap() takes mode_lock but ignores
eswitch_operation_in_progress. mlx5_devlink_eswitch_encap_mode_set()
claims the operation and drops mode_lock while rebuilding the FDB and
updating offloads.encap, so a reservation can read a stale or
rolled-back encap value. In diagram form:
T1: first IPsec SA (NIC table) T2: encap none -> basic
mlx5_devlink_eswitch_encap_mode_set()
down_write(&esw->mode_lock)
sees num_block_encap == 0
eswitch_operation_in_progress = true
up_write(&esw->mode_lock)
esw_destroy_offloads_fdb_tables()
mlx5e_xfrm_add_state()
mlx5e_ipsec_fs_tunnel_allowed()
mlx5_eswitch_block_encap()
down_write(&esw->mode_lock)
reads encap == NONE
num_block_encap++
up_write(&esw->mode_lock)
esw->offloads.encap = BASIC
esw_create_offloads_fdb_tables()
The race happens therefore because offloads.encap is not consistently
accessed under mode_lock. There are other variations of the above race
(e.g. in rollback, or in tx_create()).
Use mlx5_esw_lock() to reject a reservation while an operation is in
progress. This implies changing mlx5e_ipsec_fs_tunnel_allowed() to
propagate the error. Note that these are not new failure modes as it
seems on first glance, because if the eswitch_operation_in_progress flag
is set, rx_get()/tx_get()->mlx5_eswitch_block_mode() already fails with
-EBUSY. The new code simply protects against an operation initiated in
the short window after mlx5_eswitch_block_mode().
This race was found by Sashiko during inspection of another patch of
this series. No attempt has been made to trigger it, as it requires very
precise timing.
Fixes: baac8351f74c ("net/mlx5e: Reduce eswitch mode_lock protection context")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261105211637.1083978-3-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
