Merge branch 'work.const-qstr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[cascardo/linux.git] / security / security.c
index d441f45..4838e7f 100644 (file)
@@ -700,18 +700,39 @@ int security_inode_killpriv(struct dentry *dentry)
 
 int security_inode_getsecurity(struct inode *inode, const char *name, void **buffer, bool alloc)
 {
+       struct security_hook_list *hp;
+       int rc;
+
        if (unlikely(IS_PRIVATE(inode)))
                return -EOPNOTSUPP;
-       return call_int_hook(inode_getsecurity, -EOPNOTSUPP, inode, name,
-                               buffer, alloc);
+       /*
+        * Only one module will provide an attribute with a given name.
+        */
+       list_for_each_entry(hp, &security_hook_heads.inode_getsecurity, list) {
+               rc = hp->hook.inode_getsecurity(inode, name, buffer, alloc);
+               if (rc != -EOPNOTSUPP)
+                       return rc;
+       }
+       return -EOPNOTSUPP;
 }
 
 int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
 {
+       struct security_hook_list *hp;
+       int rc;
+
        if (unlikely(IS_PRIVATE(inode)))
                return -EOPNOTSUPP;
-       return call_int_hook(inode_setsecurity, -EOPNOTSUPP, inode, name,
-                               value, size, flags);
+       /*
+        * Only one module will provide an attribute with a given name.
+        */
+       list_for_each_entry(hp, &security_hook_heads.inode_setsecurity, list) {
+               rc = hp->hook.inode_setsecurity(inode, name, value, size,
+                                                               flags);
+               if (rc != -EOPNOTSUPP)
+                       return rc;
+       }
+       return -EOPNOTSUPP;
 }
 
 int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)