diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-10 20:11:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-10 20:11:50 -0400 |
commit | 97d2116708ca0fd6ad8b00811ee4349b7e19e96f (patch) | |
tree | 81f73fc1a6daee60737b591cf1be73cc4f79de37 /security/selinux/hooks.c | |
parent | 30066ce675d3af350bc5a53858991c0b518dda00 (diff) | |
parent | fd50ecaddf8372a1d96e0daeaac0f93cf04e4d42 (diff) |
Merge branch 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs xattr updates from Al Viro:
"xattr stuff from Andreas
This completes the switch to xattr_handler ->get()/->set() from
->getxattr/->setxattr/->removexattr"
* 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
vfs: Remove {get,set,remove}xattr inode operations
xattr: Stop calling {get,set,remove}xattr inode operations
vfs: Check for the IOP_XATTR flag in listxattr
xattr: Add __vfs_{get,set,remove}xattr helpers
libfs: Use IOP_XATTR flag for empty directory handling
vfs: Use IOP_XATTR flag for bad-inode handling
vfs: Add IOP_XATTR inode operations flag
vfs: Move xattr_resolve_name to the front of fs/xattr.c
ecryptfs: Switch to generic xattr handlers
sockfs: Get rid of getxattr iop
sockfs: getxattr: Fail with -EOPNOTSUPP for invalid attribute names
kernfs: Switch to generic xattr handlers
hfs: Switch to generic xattr handlers
jffs2: Remove jffs2_{get,set,remove}xattr macros
xattr: Remove unnecessary NULL attribute name check
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 2205ea27aa0a..085057936287 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -507,14 +507,14 @@ static int sb_finish_set_opts(struct super_block *sb) | |||
507 | the root directory. -ENODATA is ok, as this may be | 507 | the root directory. -ENODATA is ok, as this may be |
508 | the first boot of the SELinux kernel before we have | 508 | the first boot of the SELinux kernel before we have |
509 | assigned xattr values to the filesystem. */ | 509 | assigned xattr values to the filesystem. */ |
510 | if (!root_inode->i_op->getxattr) { | 510 | if (!(root_inode->i_opflags & IOP_XATTR)) { |
511 | printk(KERN_WARNING "SELinux: (dev %s, type %s) has no " | 511 | printk(KERN_WARNING "SELinux: (dev %s, type %s) has no " |
512 | "xattr support\n", sb->s_id, sb->s_type->name); | 512 | "xattr support\n", sb->s_id, sb->s_type->name); |
513 | rc = -EOPNOTSUPP; | 513 | rc = -EOPNOTSUPP; |
514 | goto out; | 514 | goto out; |
515 | } | 515 | } |
516 | rc = root_inode->i_op->getxattr(root, root_inode, | 516 | |
517 | XATTR_NAME_SELINUX, NULL, 0); | 517 | rc = __vfs_getxattr(root, root_inode, XATTR_NAME_SELINUX, NULL, 0); |
518 | if (rc < 0 && rc != -ENODATA) { | 518 | if (rc < 0 && rc != -ENODATA) { |
519 | if (rc == -EOPNOTSUPP) | 519 | if (rc == -EOPNOTSUPP) |
520 | printk(KERN_WARNING "SELinux: (dev %s, type " | 520 | printk(KERN_WARNING "SELinux: (dev %s, type " |
@@ -1410,11 +1410,10 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1410 | case SECURITY_FS_USE_NATIVE: | 1410 | case SECURITY_FS_USE_NATIVE: |
1411 | break; | 1411 | break; |
1412 | case SECURITY_FS_USE_XATTR: | 1412 | case SECURITY_FS_USE_XATTR: |
1413 | if (!inode->i_op->getxattr) { | 1413 | if (!(inode->i_opflags & IOP_XATTR)) { |
1414 | isec->sid = sbsec->def_sid; | 1414 | isec->sid = sbsec->def_sid; |
1415 | break; | 1415 | break; |
1416 | } | 1416 | } |
1417 | |||
1418 | /* Need a dentry, since the xattr API requires one. | 1417 | /* Need a dentry, since the xattr API requires one. |
1419 | Life would be simpler if we could just pass the inode. */ | 1418 | Life would be simpler if we could just pass the inode. */ |
1420 | if (opt_dentry) { | 1419 | if (opt_dentry) { |
@@ -1445,14 +1444,12 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1445 | goto out_unlock; | 1444 | goto out_unlock; |
1446 | } | 1445 | } |
1447 | context[len] = '\0'; | 1446 | context[len] = '\0'; |
1448 | rc = inode->i_op->getxattr(dentry, inode, XATTR_NAME_SELINUX, | 1447 | rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, context, len); |
1449 | context, len); | ||
1450 | if (rc == -ERANGE) { | 1448 | if (rc == -ERANGE) { |
1451 | kfree(context); | 1449 | kfree(context); |
1452 | 1450 | ||
1453 | /* Need a larger buffer. Query for the right size. */ | 1451 | /* Need a larger buffer. Query for the right size. */ |
1454 | rc = inode->i_op->getxattr(dentry, inode, XATTR_NAME_SELINUX, | 1452 | rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, NULL, 0); |
1455 | NULL, 0); | ||
1456 | if (rc < 0) { | 1453 | if (rc < 0) { |
1457 | dput(dentry); | 1454 | dput(dentry); |
1458 | goto out_unlock; | 1455 | goto out_unlock; |
@@ -1465,9 +1462,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1465 | goto out_unlock; | 1462 | goto out_unlock; |
1466 | } | 1463 | } |
1467 | context[len] = '\0'; | 1464 | context[len] = '\0'; |
1468 | rc = inode->i_op->getxattr(dentry, inode, | 1465 | rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, context, len); |
1469 | XATTR_NAME_SELINUX, | ||
1470 | context, len); | ||
1471 | } | 1466 | } |
1472 | dput(dentry); | 1467 | dput(dentry); |
1473 | if (rc < 0) { | 1468 | if (rc < 0) { |