Re: [RFC][PATCH] debugfs: Fix corrupted loop in debugfs_remove_recursive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 12, 2014 at 11:43:14AM +0100, Al Viro wrote:
> On Mon, Jun 09, 2014 at 02:06:07PM -0400, Steven Rostedt wrote:
> 
> > When these are called, the d_entry and inode locks need to be released
> > to call the instance creation and deletion code. That code has its own
> > accounting and locking to serialize everything to prevent multiple
> > users from causing harm. As the parent "instance" directory can not
> > be modified this simplifies things.
> 
> Yecchhh...   Looking at debugfs:
> 
> static inline int debugfs_positive(struct dentry *dentry)
> {
>         return dentry->d_inode && !d_unhashed(dentry);
> }
> 
> ...
>         if (debugfs_positive(dentry)) {
>                 if (dentry->d_inode) {
> What the hell?
> 
>         parent = dentry->d_parent;
>         if (!parent || !parent->d_inode)
>                 return;
> Huh?  First of all, ->d_parent is *never* NULL.  Moreover, it can't be a
> negative dentry.
> 
> What's more, if debugfs_rename() is ever used for cross-directory renames,
> this tree-walker is buggered - it'll happily walk up "back" into a directory
> it has never visited...

All of that code has been there since before 2.11, I really don't
remember how I came up with it at all, sorry.

I'm working on converting debugfs to use kernfs, so all of the debugfs
mess and problems should go away soon.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux