[PATCH][TRIVIAL] mmap.c corner case fix

DervishD (raul@pleyades.net)
Tue, 14 Jan 2003 10:39:02 +0100


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-31311-1042537665-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Content-Disposition: inline

Hi Marcelo :)

This patch fixes a corner case on the mmap() syscall.

The patch is from David S. Miller, not me. My patch was
incomplete and did nothing on 'big TASK_SIZE' architectures.

The patch is against both 2.4.20 and 2.4.21-pre, is just the same.
Please apply. I sent you the incomplete patch at pre-1 and this bug
is getting older by the minute ;))

Thanks :)

Razl

--=_courier-31311-1042537665-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Content-Description: mmap.c.diff for 2.4.20 and 2.4.21-pre
Content-Disposition: attachment; filename="mmap.c.2.4.20.diff"
X-Mime-Autoconverted: from 8bit to 7bit by courier 0.39

--- linux/mm/mmap.c.orig 2002-12-11 13:59:37.000000000 +0100
+++ linux/mm/mmap.c 2002-12-11 14:01:16.000000000 +0100
@@ -403,10 +403,12 @@
if (file && (!file->f_op || !file->f_op->mmap))
return -ENODEV;

- if ((len = PAGE_ALIGN(len)) == 0)
+ if (!len)
return addr;

- if (len > TASK_SIZE)
+ len = PAGE_ALIGN(len);
+
+ if (len > TASK_SIZE || len == 0)
return -EINVAL;

/* offset overflow? */

--=_courier-31311-1042537665-0001-2--