aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/rpc_pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r--net/sunrpc/rpc_pipe.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index f6f60f625e3f..8fa718201e3f 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -417,7 +417,7 @@ enum {
417struct rpc_filelist { 417struct rpc_filelist {
418 char *name; 418 char *name;
419 const struct file_operations *i_fop; 419 const struct file_operations *i_fop;
420 int mode; 420 umode_t mode;
421}; 421};
422 422
423static struct rpc_filelist files[] = { 423static struct rpc_filelist files[] = {
@@ -516,7 +516,7 @@ rpc_release_path(struct nameidata *nd)
516} 516}
517 517
518static struct inode * 518static struct inode *
519rpc_get_inode(struct super_block *sb, int mode) 519rpc_get_inode(struct super_block *sb, umode_t mode)
520{ 520{
521 struct inode *inode = new_inode(sb); 521 struct inode *inode = new_inode(sb);
522 if (!inode) 522 if (!inode)
@@ -589,7 +589,8 @@ rpc_populate(struct dentry *parent,
589 struct inode *inode, *dir = parent->d_inode; 589 struct inode *inode, *dir = parent->d_inode;
590 void *private = RPC_I(dir)->private; 590 void *private = RPC_I(dir)->private;
591 struct dentry *dentry; 591 struct dentry *dentry;
592 int mode, i; 592 umode_t mode;
593 int i;
593 594
594 mutex_lock(&dir->i_mutex); 595 mutex_lock(&dir->i_mutex);
595 for (i = start; i < eof; i++) { 596 for (i = start; i < eof; i++) {
@@ -783,6 +784,12 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name,
783 struct dentry *dentry; 784 struct dentry *dentry;
784 struct inode *dir, *inode; 785 struct inode *dir, *inode;
785 struct rpc_inode *rpci; 786 struct rpc_inode *rpci;
787 umode_t umode = S_IFIFO | S_IRUSR | S_IWUSR;
788
789 if (ops->upcall == NULL)
790 umode &= ~S_IRUGO;
791 if (ops->downcall == NULL)
792 umode &= ~S_IWUGO;
786 793
787 dentry = rpc_lookup_create(parent, name, strlen(name), 0); 794 dentry = rpc_lookup_create(parent, name, strlen(name), 0);
788 if (IS_ERR(dentry)) 795 if (IS_ERR(dentry))
@@ -799,7 +806,7 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name,
799 rpci->nkern_readwriters++; 806 rpci->nkern_readwriters++;
800 goto out; 807 goto out;
801 } 808 }
802 inode = rpc_get_inode(dir->i_sb, S_IFIFO | S_IRUSR | S_IWUSR); 809 inode = rpc_get_inode(dir->i_sb, umode);
803 if (!inode) 810 if (!inode)
804 goto err_dput; 811 goto err_dput;
805 inode->i_ino = iunique(dir->i_sb, 100); 812 inode->i_ino = iunique(dir->i_sb, 100);