[PATCH] net/wanrouter/wanproc.c

From: Akash Jain (aki51@acura.stanford.edu)
Date: Wed May 23 2001 - 01:08:35 EST


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

--- net/wanrouter/wanproc.c.orig Thu Apr 12 12:11:39 2001
+++ net/wanrouter/wanproc.c Thu May 17 12:52:05 2001
@@ -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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 23 2001 - 21:00:50 EST