Commit 59f2f84
bpf: Avoid kfree_rcu() under lock in bpf_lpm_trie.
syzbot reported the following lock sequence:
cpu 2:
grabs timer_base lock
spins on bpf_lpm lock
cpu 1:
grab rcu krcp lock
spins on timer_base lock
cpu 0:
grab bpf_lpm lock
spins on rcu krcp lock
bpf_lpm lock can be the same.
timer_base lock can also be the same due to timer migration.
but rcu krcp lock is always per-cpu, so it cannot be the same lock.
Hence it's a false positive.
To avoid lockdep complaining move kfree_rcu() after spin_unlock.
Reported-by: [email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]1 parent 201874f commit 59f2f84
1 file changed
+9
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| 319 | + | |
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
| |||
390 | 391 | | |
391 | 392 | | |
392 | 393 | | |
393 | | - | |
| 394 | + | |
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
| |||
437 | 438 | | |
438 | 439 | | |
439 | 440 | | |
| 441 | + | |
440 | 442 | | |
441 | 443 | | |
442 | 444 | | |
| |||
445 | 447 | | |
446 | 448 | | |
447 | 449 | | |
| 450 | + | |
448 | 451 | | |
449 | 452 | | |
450 | 453 | | |
| |||
514 | 517 | | |
515 | 518 | | |
516 | 519 | | |
517 | | - | |
518 | | - | |
| 520 | + | |
| 521 | + | |
519 | 522 | | |
520 | 523 | | |
521 | 524 | | |
| |||
529 | 532 | | |
530 | 533 | | |
531 | 534 | | |
532 | | - | |
| 535 | + | |
533 | 536 | | |
534 | 537 | | |
535 | 538 | | |
| 539 | + | |
| 540 | + | |
536 | 541 | | |
537 | 542 | | |
538 | 543 | | |
| |||
0 commit comments