Hi,
On 25/12/2025 6:20 PM, Gregory Etelson wrote:
When multiple threads attempt to create the SRH flex parser
simultaneously, only the first thread (T[0]) can proceed to the
initialization code.
Before doing so, T[0] increases the SRH flex parser reference counter.
Other threads (T[i]) entering the SRH creation function also increase
the reference counter before returning a successful code to their
respective caller functions (CF[i]).
This can lead to three issues:
1. CF[i] may receive a successful return code from the SRH flex parser
creation function before T[0] completes the parser construction.
2. If T[0] fails to create the SRH flex parser, CF[i] will not be
aware and will assume the parser is valid.
3. If T[0] fails, it will not update the SRH flex parser reference
counter.
The patch addresses these issues by locking the SRH flex parser node
creation attempt.
The first thread to enter the locked section will proceed with the
node creation.
If successful, T[0] increases the node reference counter and removes
the lock.
If it fails, T[0] removes the lock and returns an error.
For other threads (T[i]) that obtain the lock, if the flex parser node
reference count is non-zero, the node has already been created.
These threads will then increase the reference counter and return
success.
Otherwise, they will behave like T[0].
Fixes: 00e579166cc0 ("net/mlx5: support IPv6 routing extension matching")
Cc: [email protected]
Signed-off-by: Gregory Etelson <[email protected]>
Acked-by: Viacheslav Ovsiienko <[email protected]>
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh