diff options
Diffstat (limited to 'include/linux/security.h')
-rw-r--r-- | include/linux/security.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index 59a11e19b617..6423abf1ac0f 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -1797,17 +1797,21 @@ static inline int security_settime(struct timespec *ts, struct timezone *tz) | |||
1797 | 1797 | ||
1798 | static inline int security_vm_enough_memory(long pages) | 1798 | static inline int security_vm_enough_memory(long pages) |
1799 | { | 1799 | { |
1800 | WARN_ON(current->mm == NULL); | ||
1800 | return cap_vm_enough_memory(current->mm, pages); | 1801 | return cap_vm_enough_memory(current->mm, pages); |
1801 | } | 1802 | } |
1802 | 1803 | ||
1803 | static inline int security_vm_enough_memory_kern(long pages) | 1804 | static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) |
1804 | { | 1805 | { |
1805 | return cap_vm_enough_memory(current->mm, pages); | 1806 | WARN_ON(mm == NULL); |
1807 | return cap_vm_enough_memory(mm, pages); | ||
1806 | } | 1808 | } |
1807 | 1809 | ||
1808 | static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) | 1810 | static inline int security_vm_enough_memory_kern(long pages) |
1809 | { | 1811 | { |
1810 | return cap_vm_enough_memory(mm, pages); | 1812 | /* If current->mm is a kernel thread then we will pass NULL, |
1813 | for this specific case that is fine */ | ||
1814 | return cap_vm_enough_memory(current->mm, pages); | ||
1811 | } | 1815 | } |
1812 | 1816 | ||
1813 | static inline int security_bprm_set_creds(struct linux_binprm *bprm) | 1817 | static inline int security_bprm_set_creds(struct linux_binprm *bprm) |