Commit 9b7da57
file: flush delayed work in delayed fput()
The fput() of file rcS might not have completed causing issues when
executing the file.
rcS is opened in do_populate_rootfs before executed. At the end of
do_populate_rootfs() flush_delayed_fput() is called. Now
do_populate_rootfs() assumes that all fput()s caused by
do_populate_rootfs() have completed.
But flush_delayed_fput() can only ensure that fput() on the current
delayed_fput_list has finished. Any file that has been removed from
delayed_fput_list asynchronously in the meantime might not have
completed causing the exec to fail.
do_populate_rootfs delayed_fput_list delayed_fput execve
fput() a
fput() a->b
fput() a->b->rcS
__fput(a)
fput() c
fput() c->d
__fput(b)
flush_delayed_fput
__fput(c)
__fput(d)
__fput(b)
__fput(b) execve(rcS)
Ensure that all delayed work is done by calling flush_delayed_work() in
flush_delayed_fput() explicitly.
Signed-off-by: Chen Lin <[email protected]>
Signed-off-by: Shao Mingyin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Cc: Yang Yang <[email protected]>
Cc: Yang Tao <[email protected]>
Cc: Xu Xin <[email protected]>
[brauner: rewrite commit message]
Signed-off-by: Christian Brauner <[email protected]>1 parent 1197867 commit 9b7da57
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
| 482 | + | |
481 | 483 | | |
482 | 484 | | |
483 | 485 | | |
| |||
491 | 493 | | |
492 | 494 | | |
493 | 495 | | |
| 496 | + | |
494 | 497 | | |
495 | 498 | | |
496 | 499 | | |
497 | | - | |
498 | | - | |
499 | 500 | | |
500 | 501 | | |
501 | 502 | | |
| |||
0 commit comments