lkml.org 
[lkml]   [2009]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUG] bugs in jbd2_dev_to_name() (was Re: [PATCH 00/11] [GIT PULL] more updates for the tag format)
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!)
>



\
 
 \ /
  Last update: 2009-06-22 03:37    [W:0.115 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site