Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752092AbZFVBfD (ORCPT ); Sun, 21 Jun 2009 21:35:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751444AbZFVBew (ORCPT ); Sun, 21 Jun 2009 21:34:52 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:57489 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751174AbZFVBev (ORCPT ); Sun, 21 Jun 2009 21:34:51 -0400 Message-ID: <4A3EE01C.5090600@cn.fujitsu.com> Date: Mon, 22 Jun 2009 09:36:28 +0800 From: Li Zefan User-Agent: Thunderbird 2.0.0.9 (X11/20071115) MIME-Version: 1.0 To: Theodore Tso , Li Zefan , Frederic Weisbecker , Christoph Hellwig , Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, Andrew Morton , linux-ext4@vger.kernel.org Subject: Re: [BUG] bugs in jbd2_dev_to_name() (was Re: [PATCH 00/11] [GIT PULL] more updates for the tag format) References: <20090610092644.GA20889@elte.hu> <20090610130127.GA6647@mit.edu> <20090610160303.GA10240@mit.edu> <20090611130318.GB14220@infradead.org> <20090611154751.GD9275@mit.edu> <20090611171434.GA6011@nowhere> <20090611192037.GA5116@mit.edu> <4A3B48DF.8080300@cn.fujitsu.com> <20090619123204.GC31377@mit.edu> In-Reply-To: <20090619123204.GC31377@mit.edu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1269 Lines: 37 Theodore Tso wrote: > On Fri, Jun 19, 2009 at 04:14:23PM +0800, Li Zefan wrote: >>> rcu_read_lock(); >>> if (devcache[i] && devcache[i]->device == device) { >>> ret = devcache[i]->devname; >>> rcu_read_unlock(); >>> return ret; >> It doesn't seem safe to dereference @ret outside rcu read section. > > Note the comments at the beginning of the function: > Ah, I overlooked the comments. But the patch that adds rcu locking around trace event prints never gets merged: http://lkml.org/lkml/2009/4/15/549 Steven? > The caller should use rcu_read_lock() in order to make sure the > device name stays valid until its done with it. We use > rcu_read_lock() as well to make sure we're safe in case the caller > gets sloppy, and because rcu_read_lock() is cheap and can be safely > nested. > > I suppose I should change the wording to indicate that it adds a bit > more safety (as in, the crash won't happen inside this function, but > as far as the caller is concerned, all bets are off!) > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/