diff options
| author | Sabrina Dubroca <[email protected]> | 2025-05-23 15:11:18 +0000 |
|---|---|---|
| committer | Steffen Klassert <[email protected]> | 2025-06-03 13:39:57 +0000 |
| commit | 7eb11c0ab70777b9e5145a5ba1c0a2312c3980b2 (patch) | |
| tree | 1b2bbdde98c7f1f4ca6f253be5edf1dace39c150 /net/xfrm/xfrm_user.c | |
| parent | xfrm: state: initialize state_ptrs earlier in xfrm_state_find (diff) | |
| download | kernel-7eb11c0ab70777b9e5145a5ba1c0a2312c3980b2.tar.gz kernel-7eb11c0ab70777b9e5145a5ba1c0a2312c3980b2.zip | |
xfrm: state: use a consistent pcpu_id in xfrm_state_find
If we get preempted during xfrm_state_find, we could run
xfrm_state_look_at using a different pcpu_id than the one
xfrm_state_find saw. This could lead to ignoring states that should
have matched, and triggering acquires on a CPU that already has a pcpu
state.
xfrm_state_find starts on CPU1
pcpu_id = 1
lookup starts
<preemption, we're now on CPU2>
xfrm_state_look_at pcpu_id = 2
finds a state
found:
best->pcpu_num != pcpu_id (2 != 1)
if (!x && !error && !acquire_in_progress) {
...
xfrm_state_alloc
xfrm_init_tempstate
...
This can be avoided by passing the original pcpu_id down to all
xfrm_state_look_at() calls.
Also switch to raw_smp_processor_id, disabling preempting just to
re-enable it immediately doesn't really make sense.
Fixes: 1ddf9916ac09 ("xfrm: Add support for per cpu xfrm state handling.")
Signed-off-by: Sabrina Dubroca <[email protected]>
Reviewed-by: Florian Westphal <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
Diffstat (limited to 'net/xfrm/xfrm_user.c')
0 files changed, 0 insertions, 0 deletions
