RE: [PATCH] net/wanrouter/wanproc.c

David Mandelstam (dm@sangoma.com)
Wed, 23 May 2001 12:29:40 -0400


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: dm@sangoma.com
Web site: www.sangoma.com

> -----Original Message-----
> From: Akash Jain [mailto:aki51@acura.stanford.edu]
> Sent: Tuesday, May 22, 2001 11:09 PM
> To: ncorbic@sangoma.com; dm@sangoma.com; torvalds@transmeta.com;
> alan@lxorguk.ukuu.org.uk
> Cc: linux-kernel@vger.kernel.org; su.class.cs99q@nntp.stanford.edu
> Subject: [PATCH] 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
>
> --- 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/