madvise() syscall: don't test arguments holding semaphore
Subsystems (2)
PATCH 1/1 madvise() syscall: don't test arguments holding semaphore
Hi,
madvise() system call checks its arguments holding current->mm->mmap_sem semaphore. I know that madvise() shouldn't be perfomance critical, but fix it so obvious :) Patch against 2.6.1-rc
Best regards.
Signature · 2 lines
Andrey Panin | Linux and UNIX system administrator [email protected] | PGP key: wwwkeys.pgp.net
mm/madvise.c +7 -7
@@ -166,20 +166,20 @@unsigned long end;struct vm_area_struct * vma;int unmapped_error =0 ; -int error = -EINVAL ; - -down_write (¤t->mm->mmap_sem); +int error;if (start & ~PAGE_MASK ) - goto out; +return -EINVAL ; + len = (len + ~PAGE_MASK ) &PAGE_MASK ; end = start + len;if (end < start) - goto out; +return -EINVAL ; - error =0 ;if (end == start) - goto out; +return 0 ; + +down_write (¤t->mm->mmap_sem);/* * If the interval [start,end) covers some unmapped address