aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/capi
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-05-08 16:23:30 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-05-09 10:51:34 -0400
commitb0c4f3222c7406f0aee9d52b7d604a1d36108463 (patch)
treeed7bcb1f3ff828b90794453d8101cb7ecba05bf3 /drivers/isdn/capi
parent2a32cebd6cbcc43996c3e2d114fa32ba1e71192a (diff)
Fix the race between capifs remount and node creation
we don't want to deal with half-updated config Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/isdn/capi')
-rw-r--r--drivers/isdn/capi/capifs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c
index 8f9f3b5a3e8c..bff72d81f263 100644
--- a/drivers/isdn/capi/capifs.c
+++ b/drivers/isdn/capi/capifs.c
@@ -75,14 +75,17 @@ static int capifs_remount(struct super_block *s, int *flags, char *data)
75 } 75 }
76 } 76 }
77 77
78 replace_mount_options(s, new_opt); 78 mutex_lock(&s->s_root->d_inode->i_mutex);
79 79
80 replace_mount_options(s, new_opt);
80 config.setuid = setuid; 81 config.setuid = setuid;
81 config.setgid = setgid; 82 config.setgid = setgid;
82 config.uid = uid; 83 config.uid = uid;
83 config.gid = gid; 84 config.gid = gid;
84 config.mode = mode; 85 config.mode = mode;
85 86
87 mutex_unlock(&s->s_root->d_inode->i_mutex);
88
86 return 0; 89 return 0;
87} 90}
88 91
@@ -153,13 +156,16 @@ void capifs_new_ncci(unsigned int number, dev_t device)
153 if (!inode) 156 if (!inode)
154 return; 157 return;
155 inode->i_ino = number+2; 158 inode->i_ino = number+2;
159
160 dentry = get_node(number);
161
162 /* config contents is protected by root's i_mutex */
156 inode->i_uid = config.setuid ? config.uid : current_fsuid(); 163 inode->i_uid = config.setuid ? config.uid : current_fsuid();
157 inode->i_gid = config.setgid ? config.gid : current_fsgid(); 164 inode->i_gid = config.setgid ? config.gid : current_fsgid();
158 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 165 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
159 init_special_inode(inode, S_IFCHR|config.mode, device); 166 init_special_inode(inode, S_IFCHR|config.mode, device);
160 //inode->i_op = &capifs_file_inode_operations; 167 //inode->i_op = &capifs_file_inode_operations;
161 168
162 dentry = get_node(number);
163 if (!IS_ERR(dentry) && !dentry->d_inode) 169 if (!IS_ERR(dentry) && !dentry->d_inode)
164 d_instantiate(dentry, inode); 170 d_instantiate(dentry, inode);
165 mutex_unlock(&capifs_root->d_inode->i_mutex); 171 mutex_unlock(&capifs_root->d_inode->i_mutex);