[PATCH] Keys: Add LSM hooks for key management [try #3]
[linux-2.6.git] / security / keys / permission.c
index 03db073ba45c526ef82979babcc4abff47ea8438..e7f579c0eaf541e393df94815eecffc565dcde3d 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/security.h>
 #include "internal.h"
 
 /*****************************************************************************/
@@ -63,7 +64,11 @@ use_these_perms:
 
        kperm = kperm & perm & KEY_ALL;
 
-       return kperm == perm;
+       if (kperm != perm)
+               return -EACCES;
+
+       /* let LSM be the final arbiter */
+       return security_key_permission(key_ref, context, perm);
 
 } /* end key_task_permission() */