Commit a9ed4a6
epoll: Keep a reference on files added to the check list
When adding a new fd to an epoll, and that this new fd is an
epoll fd itself, we recursively scan the fds attached to it
to detect cycles, and add non-epool files to a "check list"
that gets subsequently parsed.
However, this check list isn't completely safe when deletions
can happen concurrently. To sidestep the issue, make sure that
a struct file placed on the check list sees its f_count increased,
ensuring that a concurrent deletion won't result in the file
disapearing from under our feet.
Cc: stable@vger.kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>1 parent 9123e3a commit a9ed4a6
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1994 | 1994 | | |
1995 | 1995 | | |
1996 | 1996 | | |
1997 | | - | |
| 1997 | + | |
| 1998 | + | |
1998 | 1999 | | |
1999 | 2000 | | |
| 2001 | + | |
2000 | 2002 | | |
2001 | 2003 | | |
2002 | 2004 | | |
| |||
2040 | 2042 | | |
2041 | 2043 | | |
2042 | 2044 | | |
| 2045 | + | |
2043 | 2046 | | |
2044 | 2047 | | |
2045 | 2048 | | |
| |||
2204 | 2207 | | |
2205 | 2208 | | |
2206 | 2209 | | |
2207 | | - | |
| 2210 | + | |
| 2211 | + | |
2208 | 2212 | | |
2209 | 2213 | | |
| 2214 | + | |
2210 | 2215 | | |
2211 | 2216 | | |
2212 | 2217 | | |
2213 | 2218 | | |
| 2219 | + | |
| 2220 | + | |
2214 | 2221 | | |
2215 | 2222 | | |
2216 | 2223 | | |
| |||
0 commit comments