Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
epoll: fix use-after-free in eventpoll_release_file
This fixes use-after-free of epi->fllink.next inside list loop macro. This loop actually releases elements in the body. The list is rcu-protected but here we cannot hold rcu_read_lock because we need to lock mutex inside. The obvious solution is to use list_for_each_entry_safe(). RCU-ness isn't essential because nobody can change this list under us, it's final fput for this file. The bug was introduced by ae10b2b ("epoll: optimize EPOLL_CTL_DEL using rcu") Signed-off-by: Konstantin Khlebnikov <[email protected]> Reported-by: Cyrill Gorcunov <[email protected]> Cc: Stable <[email protected]> # 3.13+ Cc: Sasha Levin <[email protected]> Cc: Jason Baron <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information