diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-17 17:56:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-17 17:56:45 -0500 |
commit | 50652963eae6afe13678dc84d789a174306a4df7 (patch) | |
tree | 44d6bc6c2cd938cf59db7ba2b7e514d9b3665f40 /security | |
parent | e2b74f232e84dfccd0047eb47545b1d028df8ff1 (diff) | |
parent | 87b95ce0964c016ede92763be9c164e49f1019e9 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc VFS updates from Al Viro:
"This cycle a lot of stuff sits on topical branches, so I'll be sending
more or less one pull request per branch.
This is the first pile; more to follow in a few. In this one are
several misc commits from early in the cycle (before I went for
separate branches), plus the rework of mntput/dput ordering on umount,
switching to use of fs_pin instead of convoluted games in
namespace_unlock()"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
switch the IO-triggering parts of umount to fs_pin
new fs_pin killing logics
allow attaching fs_pin to a group not associated with some superblock
get rid of the second argument of acct_kill()
take count and rcu_head out of fs_pin
dcache: let the dentry count go down to zero without taking d_lock
pull bumping refcount into ->kill()
kill pin_put()
mode_t whack-a-mole: chelsio
file->f_path.dentry is pinned down for as long as the file is open...
get rid of lustre_dump_dentry()
gut proc_register() a bit
kill d_validate()
ncpfs: get rid of d_validate() nonsense
selinuxfs: don't open-code d_genocide()
Diffstat (limited to 'security')
-rw-r--r-- | security/commoncap.c | 6 | ||||
-rw-r--r-- | security/selinux/selinuxfs.c | 52 |
2 files changed, 4 insertions, 54 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index 2915d8503054..f66713bd7450 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -434,7 +434,6 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data | |||
434 | */ | 434 | */ |
435 | static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_cap) | 435 | static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_cap) |
436 | { | 436 | { |
437 | struct dentry *dentry; | ||
438 | int rc = 0; | 437 | int rc = 0; |
439 | struct cpu_vfs_cap_data vcaps; | 438 | struct cpu_vfs_cap_data vcaps; |
440 | 439 | ||
@@ -446,9 +445,7 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c | |||
446 | if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) | 445 | if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) |
447 | return 0; | 446 | return 0; |
448 | 447 | ||
449 | dentry = dget(bprm->file->f_path.dentry); | 448 | rc = get_vfs_caps_from_disk(bprm->file->f_path.dentry, &vcaps); |
450 | |||
451 | rc = get_vfs_caps_from_disk(dentry, &vcaps); | ||
452 | if (rc < 0) { | 449 | if (rc < 0) { |
453 | if (rc == -EINVAL) | 450 | if (rc == -EINVAL) |
454 | printk(KERN_NOTICE "%s: get_vfs_caps_from_disk returned %d for %s\n", | 451 | printk(KERN_NOTICE "%s: get_vfs_caps_from_disk returned %d for %s\n", |
@@ -464,7 +461,6 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c | |||
464 | __func__, rc, bprm->filename); | 461 | __func__, rc, bprm->filename); |
465 | 462 | ||
466 | out: | 463 | out: |
467 | dput(dentry); | ||
468 | if (rc) | 464 | if (rc) |
469 | bprm_clear_caps(bprm); | 465 | bprm_clear_caps(bprm); |
470 | 466 | ||
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 33db1ad4fd10..1684bcc78b34 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -1195,30 +1195,8 @@ static const struct file_operations sel_commit_bools_ops = { | |||
1195 | 1195 | ||
1196 | static void sel_remove_entries(struct dentry *de) | 1196 | static void sel_remove_entries(struct dentry *de) |
1197 | { | 1197 | { |
1198 | struct list_head *node; | 1198 | d_genocide(de); |
1199 | 1199 | shrink_dcache_parent(de); | |
1200 | spin_lock(&de->d_lock); | ||
1201 | node = de->d_subdirs.next; | ||
1202 | while (node != &de->d_subdirs) { | ||
1203 | struct dentry *d = list_entry(node, struct dentry, d_child); | ||
1204 | |||
1205 | spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED); | ||
1206 | list_del_init(node); | ||
1207 | |||
1208 | if (d->d_inode) { | ||
1209 | dget_dlock(d); | ||
1210 | spin_unlock(&de->d_lock); | ||
1211 | spin_unlock(&d->d_lock); | ||
1212 | d_delete(d); | ||
1213 | simple_unlink(de->d_inode, d); | ||
1214 | dput(d); | ||
1215 | spin_lock(&de->d_lock); | ||
1216 | } else | ||
1217 | spin_unlock(&d->d_lock); | ||
1218 | node = de->d_subdirs.next; | ||
1219 | } | ||
1220 | |||
1221 | spin_unlock(&de->d_lock); | ||
1222 | } | 1200 | } |
1223 | 1201 | ||
1224 | #define BOOL_DIR_NAME "booleans" | 1202 | #define BOOL_DIR_NAME "booleans" |
@@ -1668,37 +1646,13 @@ static int sel_make_class_dir_entries(char *classname, int index, | |||
1668 | return rc; | 1646 | return rc; |
1669 | } | 1647 | } |
1670 | 1648 | ||
1671 | static void sel_remove_classes(void) | ||
1672 | { | ||
1673 | struct list_head *class_node; | ||
1674 | |||
1675 | list_for_each(class_node, &class_dir->d_subdirs) { | ||
1676 | struct dentry *class_subdir = list_entry(class_node, | ||
1677 | struct dentry, d_child); | ||
1678 | struct list_head *class_subdir_node; | ||
1679 | |||
1680 | list_for_each(class_subdir_node, &class_subdir->d_subdirs) { | ||
1681 | struct dentry *d = list_entry(class_subdir_node, | ||
1682 | struct dentry, d_child); | ||
1683 | |||
1684 | if (d->d_inode) | ||
1685 | if (d->d_inode->i_mode & S_IFDIR) | ||
1686 | sel_remove_entries(d); | ||
1687 | } | ||
1688 | |||
1689 | sel_remove_entries(class_subdir); | ||
1690 | } | ||
1691 | |||
1692 | sel_remove_entries(class_dir); | ||
1693 | } | ||
1694 | |||
1695 | static int sel_make_classes(void) | 1649 | static int sel_make_classes(void) |
1696 | { | 1650 | { |
1697 | int rc, nclasses, i; | 1651 | int rc, nclasses, i; |
1698 | char **classes; | 1652 | char **classes; |
1699 | 1653 | ||
1700 | /* delete any existing entries */ | 1654 | /* delete any existing entries */ |
1701 | sel_remove_classes(); | 1655 | sel_remove_entries(class_dir); |
1702 | 1656 | ||
1703 | rc = security_get_classes(&classes, &nclasses); | 1657 | rc = security_get_classes(&classes, &nclasses); |
1704 | if (rc) | 1658 | if (rc) |