diff options
Diffstat (limited to 'drivers/base/devtmpfs.c')
-rw-r--r-- | drivers/base/devtmpfs.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 42ae452b36b0..dac478c6e460 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c | |||
@@ -301,6 +301,19 @@ int devtmpfs_delete_node(struct device *dev) | |||
301 | if (dentry->d_inode) { | 301 | if (dentry->d_inode) { |
302 | err = vfs_getattr(nd.path.mnt, dentry, &stat); | 302 | err = vfs_getattr(nd.path.mnt, dentry, &stat); |
303 | if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { | 303 | if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { |
304 | struct iattr newattrs; | ||
305 | /* | ||
306 | * before unlinking this node, reset permissions | ||
307 | * of possible references like hardlinks | ||
308 | */ | ||
309 | newattrs.ia_uid = 0; | ||
310 | newattrs.ia_gid = 0; | ||
311 | newattrs.ia_mode = stat.mode & ~0777; | ||
312 | newattrs.ia_valid = | ||
313 | ATTR_UID|ATTR_GID|ATTR_MODE; | ||
314 | mutex_lock(&dentry->d_inode->i_mutex); | ||
315 | notify_change(dentry, &newattrs); | ||
316 | mutex_unlock(&dentry->d_inode->i_mutex); | ||
304 | err = vfs_unlink(nd.path.dentry->d_inode, | 317 | err = vfs_unlink(nd.path.dentry->d_inode, |
305 | dentry); | 318 | dentry); |
306 | if (!err || err == -ENOENT) | 319 | if (!err || err == -ENOENT) |