net/wanrouter/wanproc.c
PATCH 1/1 net/wanrouter/wanproc.c
Hi All,
I am working with Dawson Engler's meta-compillation group @ Stanford.
In net/wanrouter/wanproc.c the authors check for a bad copy_to_user and immediately return -EFAULT. However, it is necessary to rollback some allocated memory. This can leak memory over time, thus leading to system instability and lack of resources.
Thanks!
-Akash Jain
wanrouter/wanproc.c renamed from wanrouter/wanproc.c.orig +4 -2
@@ -267,8 +267,10 @@ offs = file->f_pos;if (offs < pos) { len =min (pos - offs, count); -if (copy_to_user (buf, (page + offs), len)) -return -EFAULT ; +if (copy_to_user (buf, (page + offs), len)){ +kfree (page); +return -EFAULT ; + } file->f_pos += len; }else
Hi Akash,
Thanks for this. Will get back to you.
David Mandelstam
Sangoma
Tel: (905) 474-1990 x 106
(800) 388-2475 FAX: (905) 474-9223 email: [email protected] Web site: www.sangoma.com
Quoted 36 lines
-----Original Message-----
From: Akash Jain [mailto:[email protected]]
Sent: Tuesday, May 22, 2001 11:09 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH]net/wanrouter/wanproc.cHi All,
I am working with Dawson Engler's meta-compillation group @ Stanford.In
net/wanrouter/wanproc.cthe authors check for a badcopy_to_userand immediately return-EFAULT. However, it is necessary to rollback some allocated memory. This can leak memory over time, thus leading to system instability and lack of resources.Thanks!
(quoted diff) +0
-1-Akash Jainwanrouter/wanproc.c renamed from wanrouter/wanproc.c.orig +4
-2@@ -267,8 +267,10 @@ offs = file->f_pos;if (offs < pos) { len =min (pos - offs, count); -if (copy_to_user (buf, (page + offs), len)) -return -EFAULT ; +if (copy_to_user (buf, (page + offs), len)){ +kfree (page); +return -EFAULT ; + } file->f_pos += len; }else