Skip to content

Commit

Permalink
fix regression in "epoll: Keep a reference on files added to the chec…
Browse files Browse the repository at this point in the history
…k list"

[ Upstream commit 77f4689de17c0887775bb77896f4cc11a39bf848 ]

epoll_loop_check_proc() can run into a file already committed to destruction;
we can't grab a reference on those and don't need to add them to the set for
reverse path check anyway.

Bug: 147802478

Tested-by: Marc Zyngier <[email protected]>
Fixes: a9ed4a6560b8 ("epoll: Keep a reference on files added to the check list")
Signed-off-by: Al Viro <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Change-Id: I541299a6325a6e9765add9e920cfa0203de9f4a0
Signed-off-by: engstk <[email protected]>
  • Loading branch information
Al Viro authored and engstk committed Nov 3, 2020
1 parent 8b9bd8e commit 09be51f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/eventpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -1911,9 +1911,9 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
* during ep_insert().
*/
if (list_empty(&epi->ffd.file->f_tfile_llink)) {
get_file(epi->ffd.file);
list_add(&epi->ffd.file->f_tfile_llink,
&tfile_check_list);
if (get_file_rcu(epi->ffd.file))
list_add(&epi->ffd.file->f_tfile_llink,
&tfile_check_list);
}
}
}
Expand Down

0 comments on commit 09be51f

Please sign in to comment.