[PATCH] drivers/media/video/zr36120.c (repost)

Philip Wang (PXWang@stanford.edu)
Tue, 22 May 2001 18:15:30 -0700


Greetings,

I wanted to repost this zr36120 patch, both because so far it has gone
unnoticed, and because there was a problem with the text formatting which
is now fixed.

There is a bug in zr36120.c of not freeing memory on error paths. This one
is particularly dangerous, because kmalloc allocates a memory block the
size of an entire video clip! I simply free the local pointer, vcp, before
returning -EFAULT.

Philip

--- drivers/media/video/zr36120.c.orig Tue May 22 18:08:22 2001
+++ drivers/media/video/zr36120.c Tue May 22 18:08:49 2001
@@ -1195,8 +1195,10 @@
if (vcp==NULL)
return -ENOMEM;
if (vw.clipcount && copy_from_user(vcp,vw.clips,sizeof(s$
- return -EFAULT;
-
+ {
+ vfree(vcp);
+ return -EFAULT;
+ }
on = ztv->running;
if (on)
zoran_cap(ztv, 0);

-
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/