Linus Torvalds 4efaa5acf0 epoll: be better about file lifetimes
epoll can call out to vfs_poll() with a file pointer that may race with
the last 'fput()'. That would make f_count go down to zero, and while
the ep->mtx locking means that the resulting file pointer tear-down will
be blocked until the poll returns, it means that f_count is already
dead, and any use of it won't actually get a reference to the file any
more: it's dead regardless.

Make sure we have a valid ref on the file pointer before we call down to
vfs_poll() from the epoll routines.

Link: https://lore.kernel.org/lkml/0000000000002d631f0615918f1e@google.com/
Reported-by: syzbot+045b454ab35fd82a35fb@syzkaller.appspotmail.com
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-05-05 14:00:48 -07:00
..
2024-04-22 15:34:27 +00:00
2024-01-11 20:11:35 -08:00
2024-05-02 10:49:12 -07:00
2024-03-27 13:17:15 +01:00
2024-03-12 13:17:36 -07:00
2024-03-18 15:39:48 -07:00
2024-03-21 09:47:12 -07:00
\n
2024-03-13 14:30:58 -07:00
2024-03-27 13:17:15 +01:00
2024-03-27 13:17:15 +01:00
2024-03-25 10:53:39 -07:00
2023-12-29 11:58:34 -08:00
2024-03-11 09:38:17 -07:00
2024-03-11 09:38:17 -07:00
2024-03-04 18:35:21 +01:00
2024-03-27 13:17:15 +01:00
2024-03-12 14:27:37 -07:00
2024-04-29 12:07:37 -07:00
2024-04-29 14:22:24 -07:00
2024-03-27 13:17:15 +01:00
2024-03-27 13:17:15 +01:00
2024-03-12 17:44:08 -07:00
2024-04-06 09:14:18 -07:00
2024-03-12 20:03:34 -07:00
2023-10-30 19:28:19 -10:00
2024-03-11 10:07:03 -07:00
2024-03-06 10:52:12 +01:00
2024-03-11 09:38:17 -07:00
2024-03-27 09:57:30 -07:00
2024-03-11 10:07:03 -07:00
2024-03-12 20:03:34 -07:00
2023-12-12 14:24:14 +01:00
2024-03-15 09:00:09 -07:00
2024-03-13 12:53:53 -07:00
2024-03-13 12:53:53 -07:00
2024-03-11 10:21:06 -07:00
2024-03-13 12:53:53 -07:00
2024-03-12 20:03:34 -07:00
2024-03-13 12:53:53 -07:00
2024-02-02 13:11:49 +01:00
2024-03-12 20:03:34 -07:00
2024-01-08 10:57:34 -08:00
2024-03-27 13:17:15 +01:00
2024-02-15 23:43:47 -05:00