mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
nfsd: fix vm overcommit crash fix #2
The previous patch from Alan Cox ("nfsd: fix vm overcommit crash",
commit 731572d39f
) 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>
This commit is contained in:
parent
061e41fdb5
commit
1b79cd04fa
@ -1818,19 +1818,23 @@ static inline int security_settime(struct timespec *ts, struct timezone *tz)
|
||||
|
||||
static inline int security_vm_enough_memory(long pages)
|
||||
{
|
||||
return cap_vm_enough_memory(current->mm, pages);
|
||||
}
|
||||
|
||||
static inline int security_vm_enough_memory_kern(long pages)
|
||||
{
|
||||
WARN_ON(current->mm == NULL);
|
||||
return cap_vm_enough_memory(current->mm, pages);
|
||||
}
|
||||
|
||||
static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
|
||||
{
|
||||
WARN_ON(mm == NULL);
|
||||
return cap_vm_enough_memory(mm, pages);
|
||||
}
|
||||
|
||||
static inline int security_vm_enough_memory_kern(long 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_alloc(struct linux_binprm *bprm)
|
||||
{
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user