[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140109185907.20cddb57@gandalf.local.home>
Date: Thu, 9 Jan 2014 18:59:07 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: paulmck@...ux.vnet.ibm.com
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Dave Chinner <david@...morbit.com>,
linux-fsdevel@...r.kernel.org,
James Morris <james.l.morris@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Stephen Smalley <sds@...ho.nsa.gov>,
"Theodore Ts'o" <tytso@....edu>,
Eric Paris <eparis@...isplace.org>,
stable <stable@...r.kernel.org>,
Paul Moore <paul@...l-moore.com>,
LKML <linux-kernel@...r.kernel.org>,
Matthew Wilcox <matthew@....cx>,
Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH] vfs: Fix possible NULL pointer dereference in
inode_permission()
On Thu, 9 Jan 2014 15:45:37 -0800
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com> wrote:
> > static void inode_free_security(struct inode *inode)
> > {
> > struct inode_security_struct *isec = inode->i_security;
> > @@ -244,8 +252,7 @@ static void inode_free_security(struct i
> > list_del_init(&isec->list);
> > spin_unlock(&sbsec->isec_lock);
> >
> > - inode->i_security = NULL;
> > - kmem_cache_free(sel_inode_cache, isec);
> > + call_rcu(&isec->rcu, inode_free_rcu);
>
> Does not clearing ->i_security mean that RCU readers can traverse
> this pointer after the invocation of call_rcu()? If so, this is
> problematic. (If something else already prevents readers from getting
> here, no problem.)
This is called when we are about to free the inode. Look at
destroy_inode(). Basically, this is the same as doing:
call_rcu(&isec->rcu, inode_free_rcu);
call_rcu(&inode->i_rcu, i_callback);
Where i_callback() does the free of the inode.
If you can access inode->i_security, after a call_rcu, then you can
also access the inode itself that has just been freed.
Yes, technically, having two separate call_rcu(), the first grace
period can end before the second, but everything to remove the inode
from sight has already been set up before that first call_rcu() is
made. That means when the first call_rcu() is executed, the inode
should already be invisible to the readers.
- Steve
>
> Thanx, Paul
>
> > }
> >
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists