aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJunjiro R. Okajima <hooanon05@yahoo.co.jp>2008-12-02 13:31:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-02 18:50:40 -0500
commit1b79cd04fab80be61dcd2732e2423aafde9a4c1c (patch)
treeb9ff5f0de1c0ef011ac62096218d2fd4bc70c56b /include/linux
parent061e41fdb5047b1fb161e89664057835935ca1d2 (diff)
nfsd: fix vm overcommit crash fix #2
The previous patch from Alan Cox ("nfsd: fix vm overcommit crash", commit 731572d39fcd3498702eda4600db4c43d51e0b26) fixed the problem where knfsd crashes on exported shmemfs objects and strict overcommit is set. But the patch forgot supporting the case when CONFIG_SECURITY is disabled. This patch copies a part of his fix which is mainly for detecting a bug earlier. Acked-by: James Morris <jmorris@namei.org> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Junjiro R. Okajima <hooanon05@yahoo.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/security.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index c13f1cec9abb..e3d4ecda2673 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1818,17 +1818,21 @@ static inline int security_settime(struct timespec *ts, struct timezone *tz)
1818 1818
1819static inline int security_vm_enough_memory(long pages) 1819static inline int security_vm_enough_memory(long pages)
1820{ 1820{
1821 WARN_ON(current->mm == NULL);
1821 return cap_vm_enough_memory(current->mm, pages); 1822 return cap_vm_enough_memory(current->mm, pages);
1822} 1823}
1823 1824
1824static inline int security_vm_enough_memory_kern(long pages) 1825static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
1825{ 1826{
1826 return cap_vm_enough_memory(current->mm, pages); 1827 WARN_ON(mm == NULL);
1828 return cap_vm_enough_memory(mm, pages);
1827} 1829}
1828 1830
1829static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) 1831static inline int security_vm_enough_memory_kern(long pages)
1830{ 1832{
1831 return cap_vm_enough_memory(mm, pages); 1833 /* If current->mm is a kernel thread then we will pass NULL,
1834 for this specific case that is fine */
1835 return cap_vm_enough_memory(current->mm, pages);
1832} 1836}
1833 1837
1834static inline int security_bprm_alloc(struct linux_binprm *bprm) 1838static inline int security_bprm_alloc(struct linux_binprm *bprm)