diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c index 1b464390dde8..dd1ed1b8e98e 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -352,6 +352,7 @@ int __inode_permission(struct inode *inode, int mask) | |||
352 | /** | 352 | /** |
353 | * sb_permission - Check superblock-level permissions | 353 | * sb_permission - Check superblock-level permissions |
354 | * @sb: Superblock of inode to check permission on | 354 | * @sb: Superblock of inode to check permission on |
355 | * @inode: Inode to check permission on | ||
355 | * @mask: Right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC) | 356 | * @mask: Right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC) |
356 | * | 357 | * |
357 | * Separate out file-system wide checks from inode-specific permission checks. | 358 | * Separate out file-system wide checks from inode-specific permission checks. |
@@ -656,6 +657,7 @@ int sysctl_protected_hardlinks __read_mostly = 1; | |||
656 | /** | 657 | /** |
657 | * may_follow_link - Check symlink following for unsafe situations | 658 | * may_follow_link - Check symlink following for unsafe situations |
658 | * @link: The path of the symlink | 659 | * @link: The path of the symlink |
660 | * @nd: nameidata pathwalk data | ||
659 | * | 661 | * |
660 | * In the case of the sysctl_protected_symlinks sysctl being enabled, | 662 | * In the case of the sysctl_protected_symlinks sysctl being enabled, |
661 | * CAP_DAC_OVERRIDE needs to be specifically ignored if the symlink is | 663 | * CAP_DAC_OVERRIDE needs to be specifically ignored if the symlink is |
@@ -2414,7 +2416,7 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, | |||
2414 | goto out; | 2416 | goto out; |
2415 | } | 2417 | } |
2416 | 2418 | ||
2417 | mode = op->mode & S_IALLUGO; | 2419 | mode = op->mode; |
2418 | if ((open_flag & O_CREAT) && !IS_POSIXACL(dir)) | 2420 | if ((open_flag & O_CREAT) && !IS_POSIXACL(dir)) |
2419 | mode &= ~current_umask(); | 2421 | mode &= ~current_umask(); |
2420 | 2422 | ||
@@ -2452,7 +2454,7 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, | |||
2452 | } | 2454 | } |
2453 | 2455 | ||
2454 | if (open_flag & O_CREAT) { | 2456 | if (open_flag & O_CREAT) { |
2455 | error = may_o_create(&nd->path, dentry, op->mode); | 2457 | error = may_o_create(&nd->path, dentry, mode); |
2456 | if (error) { | 2458 | if (error) { |
2457 | create_error = error; | 2459 | create_error = error; |
2458 | if (open_flag & O_EXCL) | 2460 | if (open_flag & O_EXCL) |
@@ -2489,6 +2491,10 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, | |||
2489 | dput(dentry); | 2491 | dput(dentry); |
2490 | dentry = file->f_path.dentry; | 2492 | dentry = file->f_path.dentry; |
2491 | } | 2493 | } |
2494 | if (create_error && dentry->d_inode == NULL) { | ||
2495 | error = create_error; | ||
2496 | goto out; | ||
2497 | } | ||
2492 | goto looked_up; | 2498 | goto looked_up; |
2493 | } | 2499 | } |
2494 | 2500 | ||