Commit 697f514
landlock: Clean up interrupted thread logic in TSYNC
In landlock_restrict_sibling_threads(), when the calling thread is
interrupted while waiting for sibling threads to prepare, it executes
a recovery path.
Previously, this path included a wait_for_completion() call on
all_prepared to prevent a Use-After-Free of the local shared_ctx.
However, this wait is redundant. Exiting the main do-while loop
already leads to a bottom cleanup section that unconditionally waits
for all_finished. Therefore, replacing the wait with a simple break
is safe, prevents UAF, and correctly unblocks the remaining task_works.
Clean up the error path by breaking the loop and updating the
surrounding comments to accurately reflect the state machine.
Suggested-by: Günther Noack <[email protected]>
Signed-off-by: Yihan Ding <[email protected]>
Tested-by: Günther Noack <[email protected]>
Reviewed-by: Günther Noack <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mickaël Salaün <[email protected]>1 parent ff88df6 commit 697f514
1 file changed
Lines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
579 | | - | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
580 | 584 | | |
581 | 585 | | |
582 | 586 | | |
583 | 587 | | |
584 | | - | |
585 | | - | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
586 | 591 | | |
587 | | - | |
| 592 | + | |
588 | 593 | | |
589 | 594 | | |
590 | 595 | | |
591 | 596 | | |
592 | 597 | | |
593 | 598 | | |
594 | | - | |
595 | | - | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
596 | 602 | | |
597 | 603 | | |
598 | 604 | | |
| |||
0 commit comments