diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2007-08-22 17:01:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-22 22:52:45 -0400 |
commit | 34b4e4aa3c470ce8fa2bd78abb1741b4b58baad7 (patch) | |
tree | 91d620288f1aaf63c12dc84ca1015465818601f2 /include/linux/mm.h | |
parent | afe1ab4d577892822de2c8e803fbfaed6ec44ba3 (diff) |
fix NULL pointer dereference in __vm_enough_memory()
The new exec code inserts an accounted vma into an mm struct which is not
current->mm. The existing memory check code has a hard coded assumption
that this does not happen as does the security code.
As the correct mm is known we pass the mm to the security method and the
helper function. A new security test is added for the case where we need
to pass the mm and the existing one is modified to pass current->mm to
avoid the need to change large amounts of code.
(Thanks to Tobias for fixing rejects and testing)
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: WU Fengguang <wfg@mail.ustc.edu.cn>
Cc: James Morris <jmorris@redhat.com>
Cc: Tobias Diedrich <ranma+kernel@tdiedrich.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 655094dc9440..1692dd6cb915 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1042,7 +1042,7 @@ static inline void vma_nonlinear_insert(struct vm_area_struct *vma, | |||
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | /* mmap.c */ | 1044 | /* mmap.c */ |
1045 | extern int __vm_enough_memory(long pages, int cap_sys_admin); | 1045 | extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin); |
1046 | extern void vma_adjust(struct vm_area_struct *vma, unsigned long start, | 1046 | extern void vma_adjust(struct vm_area_struct *vma, unsigned long start, |
1047 | unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert); | 1047 | unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert); |
1048 | extern struct vm_area_struct *vma_merge(struct mm_struct *, | 1048 | extern struct vm_area_struct *vma_merge(struct mm_struct *, |