From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 17 Jun 2014 09:50:42 +0400 From: Cyrill Gorcunov To: Konstantin Khlebnikov Cc: Andrew Morton , linux-kernel@vger.kernel.org, Sasha Levin , Jason Baron , Linus Torvalds , Stable Subject: Re: [PATCH] epoll: fix use-after-free in eventpoll_release_file Message-ID: <20140617055042.GA3064@moon> References: <20140617025805.29539.22007.stgit@zurg> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140617025805.29539.22007.stgit@zurg> Sender: linux-kernel-owner@vger.kernel.org List-ID: On Tue, Jun 17, 2014 at 06:58:05AM +0400, Konstantin Khlebnikov wrote: > This fixes use-after-free of epi->fllink.next inside list loop macro. > This loop actually releases elements in the body. List is rcu-protected > but here we cannot hold rcu_read_lock because we need to lock mutex inside. > > 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. > > Bug is here since ae10b2b4eb01bedc91d29d5c5bb9e416fd806c40 > ("epoll: optimize EPOLL_CTL_DEL using rcu") > > Signed-off-by: Konstantin Khlebnikov > Reported-by: Cyrill Gorcunov > Cc: Stable # 3.13+ > Cc: Sasha Levin > Cc: Jason Baron Acked-by: Cyrill Gorcunov