Merge branch 'master' into next
[linux-2.6-block.git] / include / linux / security.h
index 59a11e19b617d2b2e55151a8214d5163cccefd4c..6423abf1ac0faee1385d460bcd9951b1bd85a955 100644 (file)
@@ -1797,17 +1797,21 @@ static inline int security_settime(struct timespec *ts, struct timezone *tz)
 
 static inline int security_vm_enough_memory(long pages)
 {
+       WARN_ON(current->mm == NULL);
        return cap_vm_enough_memory(current->mm, pages);
 }
 
-static inline int security_vm_enough_memory_kern(long pages)
+static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
 {
-       return cap_vm_enough_memory(current->mm, pages);
+       WARN_ON(mm == NULL);
+       return cap_vm_enough_memory(mm, pages);
 }
 
-static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
+static inline int security_vm_enough_memory_kern(long pages)
 {
-       return cap_vm_enough_memory(mm, pages);
+       /* If current->mm is a kernel thread then we will pass NULL,
+          for this specific case that is fine */
+       return cap_vm_enough_memory(current->mm, pages);
 }
 
 static inline int security_bprm_set_creds(struct linux_binprm *bprm)