lkml.org 
[lkml]   [2004]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH][TRIVIAL] 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.

--
Andrey Panin | Linux and UNIX system administrator
pazke@donpac.ru | PGP key: wwwkeys.pgp.net
diff -urN -X /usr/share/dontdiff linux-2.6.0-test3.vanilla/mm/madvise.c linux-2.6.0-test3/mm/madvise.c
--- linux-2.6.0-test3.vanilla/mm/madvise.c 2003-08-09 08:34:02.000000000 +0400
+++ linux-2.6.0-test3/mm/madvise.c 2004-01-01 16:51:58.000000000 +0300
@@ -166,20 +166,20 @@
unsigned long end;
struct vm_area_struct * vma;
int unmapped_error = 0;
- int error = -EINVAL;
-
- down_write(&current->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(&current->mm->mmap_sem);

/*
* If the interval [start,end) covers some unmapped address[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:59    [W:0.040 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site