From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754372Ab0DNIgr (ORCPT ); Wed, 14 Apr 2010 04:36:47 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:55955 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753134Ab0DNIgp (ORCPT ); Wed, 14 Apr 2010 04:36:45 -0400 Message-ID: <4BC57E7D.9060706@cn.fujitsu.com> Date: Wed, 14 Apr 2010 16:36:13 +0800 From: Lai Jiangshan User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Eric Dumazet CC: David Miller , "Paul E. McKenney" , netdev , linux-kernel Subject: Re: [PATCH net-next-2.6] fasync: RCU locking References: <1271230961.16881.630.camel@edumazet-laptop> In-Reply-To: <1271230961.16881.630.camel@edumazet-laptop> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric Dumazet wrote: > -void __kill_fasync(struct fasync_struct *fa, int sig, int band) > +/* > + * rcu_read_lock() is held > + */ > +static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band) > { > while (fa) { > struct fown_struct * fown; > @@ -719,22 +728,19 @@ void __kill_fasync(struct fasync_struct *fa, int sig, int band) > mechanism. */ > if (!(sig == SIGURG && fown->signum == 0)) > send_sigio(fown, fa->fa_fd, band); > - fa = fa->fa_next; > + fa = rcu_dereference(fa->fa_next); > } > } > Since rcu_read_lock() protects fasync_struct *fa for us, we can access to @fa safely even fasync_remove_entry() is just called. But this patch does not ensure 'fa->fa_file is not freed' nor 'fa->fa_fd is not released', so kill_fasync_rcu() may do wrong thing if there is no other code ensure it.