Re: [git pull] vfs part 2

Al Viro
2012-03-31T19:42:59Z

On Sat, Mar 31, 2012 at 08:39:13PM +0100, Al Viro wrote:
> On Sat, Mar 31, 2012 at 12:29:41PM -0700, Linus Torvalds wrote:
> > On Sat, Mar 31, 2012 at 11:57 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> > >
> > > Works here... ?OK, that makes selinuxfs one the most likely suspect; let
> > > me check if I can reproduce any crap with that... ?Do you see anything
> > > selinux-related in the call chain, BTW?
> >
> > Yup.The oops scrolled off my screen, but the call chain was:
> >
> > init_sel_fs -> kernel_mount_data -> vfs_kern_mount -> mount_fs ->
> > sel_mount -> mount_single -> (scrolled off)
> >
> > and then the actual oops happens in d_alloc+0x17, which is
> > "parent->d_sb", so parent was NULL or something (the register state
> > also scrolled off, and I didn't check the fault address, so it could
> > have been some other invalid pointer too).
>
> Sigh... sel_make_dir(), last line. Should be return dentry, is return 0...
> Fixes the problem here (I've managed to reproduce it).

IOW, the incremental is

diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 364b784..d7018bf 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1804,7 +1804,7 @@ static struct dentry *sel_make_dir(struct dentry *dir, const char *name,
/* bump link count on parent directory, too */
inc_nlink(dir->d_inode);

- return 0;
+ return dentry;
}

static int sel_fill_super(struct super_block *sb, void *data, int silent)