aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-10-28 14:50:57 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 14:24:51 -0500
commit0092699643703aefca6af0aa758a73f1624d53be (patch)
tree7d6a4f563f995afea99e9a6b66af974f1bfa7437 /drivers/base
parentf38506c49dab2751567423865941f32f2ea61c45 (diff)
Driver Core: devtmpfs: ignore umask while setting file mode
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/devtmpfs.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index a1cb5afe680..48526b93568 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -156,34 +156,40 @@ int devtmpfs_create_node(struct device *dev)
156 mode |= S_IFCHR; 156 mode |= S_IFCHR;
157 157
158 curr_cred = override_creds(&init_cred); 158 curr_cred = override_creds(&init_cred);
159
159 err = vfs_path_lookup(dev_mnt->mnt_root, dev_mnt, 160 err = vfs_path_lookup(dev_mnt->mnt_root, dev_mnt,
160 nodename, LOOKUP_PARENT, &nd); 161 nodename, LOOKUP_PARENT, &nd);
161 if (err == -ENOENT) { 162 if (err == -ENOENT) {
162 /* create missing parent directories */
163 create_path(nodename); 163 create_path(nodename);
164 err = vfs_path_lookup(dev_mnt->mnt_root, dev_mnt, 164 err = vfs_path_lookup(dev_mnt->mnt_root, dev_mnt,
165 nodename, LOOKUP_PARENT, &nd); 165 nodename, LOOKUP_PARENT, &nd);
166 if (err)
167 goto out;
168 } 166 }
167 if (err)
168 goto out;
169 169
170 dentry = lookup_create(&nd, 0); 170 dentry = lookup_create(&nd, 0);
171 if (!IS_ERR(dentry)) { 171 if (!IS_ERR(dentry)) {
172 int umask;
173
174 umask = sys_umask(0000);
175 err = vfs_mknod(nd.path.dentry->d_inode, 172 err = vfs_mknod(nd.path.dentry->d_inode,
176 dentry, mode, dev->devt); 173 dentry, mode, dev->devt);
177 sys_umask(umask); 174 if (!err) {
178 /* mark as kernel created inode */ 175 struct iattr newattrs;
179 if (!err) 176
177 /* fixup possibly umasked mode */
178 newattrs.ia_mode = mode;
179 newattrs.ia_valid = ATTR_MODE;
180 mutex_lock(&dentry->d_inode->i_mutex);
181 notify_change(dentry, &newattrs);
182 mutex_unlock(&dentry->d_inode->i_mutex);
183
184 /* mark as kernel-created inode */
180 dentry->d_inode->i_private = &dev_mnt; 185 dentry->d_inode->i_private = &dev_mnt;
186 }
181 dput(dentry); 187 dput(dentry);
182 } else { 188 } else {
183 err = PTR_ERR(dentry); 189 err = PTR_ERR(dentry);
184 } 190 }
185 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
186 191
192 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
187 path_put(&nd.path); 193 path_put(&nd.path);
188out: 194out:
189 kfree(tmp); 195 kfree(tmp);