Commit 7eb11c0
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: 1ddf991 ("xfrm: Add support for per cpu xfrm state handling.")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>1 parent 94d077c commit 7eb11c0
1 file changed
Lines changed: 6 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1307 | 1307 | | |
1308 | 1308 | | |
1309 | 1309 | | |
1310 | | - | |
| 1310 | + | |
1311 | 1311 | | |
1312 | | - | |
1313 | | - | |
1314 | | - | |
1315 | | - | |
1316 | | - | |
1317 | | - | |
1318 | 1312 | | |
1319 | 1313 | | |
1320 | 1314 | | |
| |||
1381 | 1375 | | |
1382 | 1376 | | |
1383 | 1377 | | |
1384 | | - | |
1385 | | - | |
| 1378 | + | |
1386 | 1379 | | |
1387 | 1380 | | |
1388 | 1381 | | |
| |||
1402 | 1395 | | |
1403 | 1396 | | |
1404 | 1397 | | |
1405 | | - | |
| 1398 | + | |
1406 | 1399 | | |
1407 | 1400 | | |
1408 | 1401 | | |
| |||
1419 | 1412 | | |
1420 | 1413 | | |
1421 | 1414 | | |
1422 | | - | |
| 1415 | + | |
1423 | 1416 | | |
1424 | 1417 | | |
1425 | 1418 | | |
| |||
1460 | 1453 | | |
1461 | 1454 | | |
1462 | 1455 | | |
1463 | | - | |
| 1456 | + | |
1464 | 1457 | | |
1465 | 1458 | | |
1466 | 1459 | | |
| |||
1495 | 1488 | | |
1496 | 1489 | | |
1497 | 1490 | | |
1498 | | - | |
| 1491 | + | |
1499 | 1492 | | |
1500 | 1493 | | |
1501 | 1494 | | |
| |||
0 commit comments