diff options
author | Paul Moore <pmoore@redhat.com> | 2014-06-17 17:30:23 -0400 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2014-06-17 17:30:23 -0400 |
commit | 170b5910d9fbea79de1bb40df22eda5f98250c0c (patch) | |
tree | ca9560e878d2842d45c6f99077d0d8b8f8b0f9ba /security/security.c | |
parent | 47dd0b76ace953bd2c0479076db0d3e3b9594003 (diff) | |
parent | 1860e379875dfe7271c649058aeddffe5afd9d0d (diff) |
Merge tag 'v3.15' into next
Linux 3.15
Diffstat (limited to 'security/security.c')
-rw-r--r-- | security/security.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/security/security.c b/security/security.c index 919cad93ac82..8b774f362a3d 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -433,11 +433,20 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir, | |||
433 | } | 433 | } |
434 | 434 | ||
435 | int security_path_rename(struct path *old_dir, struct dentry *old_dentry, | 435 | int security_path_rename(struct path *old_dir, struct dentry *old_dentry, |
436 | struct path *new_dir, struct dentry *new_dentry) | 436 | struct path *new_dir, struct dentry *new_dentry, |
437 | unsigned int flags) | ||
437 | { | 438 | { |
438 | if (unlikely(IS_PRIVATE(old_dentry->d_inode) || | 439 | if (unlikely(IS_PRIVATE(old_dentry->d_inode) || |
439 | (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) | 440 | (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) |
440 | return 0; | 441 | return 0; |
442 | |||
443 | if (flags & RENAME_EXCHANGE) { | ||
444 | int err = security_ops->path_rename(new_dir, new_dentry, | ||
445 | old_dir, old_dentry); | ||
446 | if (err) | ||
447 | return err; | ||
448 | } | ||
449 | |||
441 | return security_ops->path_rename(old_dir, old_dentry, new_dir, | 450 | return security_ops->path_rename(old_dir, old_dentry, new_dir, |
442 | new_dentry); | 451 | new_dentry); |
443 | } | 452 | } |
@@ -524,11 +533,20 @@ int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
524 | } | 533 | } |
525 | 534 | ||
526 | int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, | 535 | int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, |
527 | struct inode *new_dir, struct dentry *new_dentry) | 536 | struct inode *new_dir, struct dentry *new_dentry, |
537 | unsigned int flags) | ||
528 | { | 538 | { |
529 | if (unlikely(IS_PRIVATE(old_dentry->d_inode) || | 539 | if (unlikely(IS_PRIVATE(old_dentry->d_inode) || |
530 | (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) | 540 | (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) |
531 | return 0; | 541 | return 0; |
542 | |||
543 | if (flags & RENAME_EXCHANGE) { | ||
544 | int err = security_ops->inode_rename(new_dir, new_dentry, | ||
545 | old_dir, old_dentry); | ||
546 | if (err) | ||
547 | return err; | ||
548 | } | ||
549 | |||
532 | return security_ops->inode_rename(old_dir, old_dentry, | 550 | return security_ops->inode_rename(old_dir, old_dentry, |
533 | new_dir, new_dentry); | 551 | new_dir, new_dentry); |
534 | } | 552 | } |