[PATCH] NFSv4: rpc_mkpipe creating socket inodes w/out sk buffers.

From: Steve Dickson
Date: Wed Sep 06 2006 - 11:48:25 EST


rpc_mkpipe sets the S_IFSOCK mode bit when it creates a
inode but does not create a true socket inode. So when other parts
of the kernel (i.e. the SELinux code in the-mm kernel) use
S_ISSOCK() to see if the inode is a socket, the macro returns true,
but the expected socket inode container structure is really
an rpc_inode container which obviously causes problems...

This patch simply change the S_IFSOCK mode bit to
S_IFIFO which eliminates the problem.

steved. This patch stop rpc_mkpipe from create S_IFSOCK nodes what don't
have associated sk buffers attached (which causes SELinux to oops
during NFSv4 mounts). Instead the S_IFIFO mode bit is set which
probably make more sense and seems to work just fine during
my connectathon and fsx testing...

Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
--------------------------------------

--- nfs-2.6/net/sunrpc/rpc_pipe.c.orig 2006-08-24 14:33:43.000000000 -0400
+++ nfs-2.6/net/sunrpc/rpc_pipe.c 2006-09-06 10:31:45.000000000 -0400
@@ -720,7 +720,7 @@ rpc_mkpipe(struct dentry *parent, const
if (IS_ERR(dentry))
return dentry;
dir = parent->d_inode;
- inode = rpc_get_inode(dir->i_sb, S_IFSOCK | S_IRUSR | S_IWUSR);
+ inode = rpc_get_inode(dir->i_sb, S_IFIFO | S_IRUSR | S_IWUSR);
if (!inode)
goto err_dput;
inode->i_ino = iunique(dir->i_sb, 100);