Konstantin Khlebnikov ebe06187bf 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 ae10b2b4eb01 ("epoll: optimize EPOLL_CTL_DEL
using rcu")

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Stable <stable@vger.kernel.org> # 3.13+
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Jason Baron <jbaron@akamai.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-06-16 17:21:59 -10:00
..
2014-06-06 16:08:09 -07:00
2014-06-04 16:53:53 -07:00
2014-06-12 00:18:51 -04:00
2014-04-18 14:20:48 +02:00
2014-01-25 03:14:05 -05:00
2014-06-06 16:08:13 -07:00
2014-05-05 17:25:50 +10:00
2014-06-12 00:18:51 -04:00
2014-05-06 17:39:36 -04:00
2014-06-14 19:43:27 -05:00
2013-10-24 23:34:54 -04:00
2014-04-19 13:23:31 -07:00
2014-05-06 17:32:52 -04:00
2014-05-06 17:31:10 -04:00
2013-11-09 00:16:20 -05:00
2013-10-24 23:34:54 -04:00
2014-02-07 16:08:57 -08:00
2014-04-01 23:19:09 -04:00
2014-05-06 17:39:42 -04:00
2014-04-01 23:19:08 -04:00
2014-04-01 23:19:08 -04:00
2014-04-01 23:19:09 -04:00
2013-11-09 00:16:31 -05:00