[patch] v4l/bttv: add sanity check (bug #3309)

From: Gerd Knorr
Date: Mon Aug 30 2004 - 08:22:04 EST


> Software Environment: gnomemeeting
> Problem Description: I have a miropctv (bttv card=1), kernel serie 2.4 have v4l
> only implementation. Kernel serie 2.6 have v4l2 only implementation (v4l
> broken). I had to go back to 2.4 to use gnomemeeting (v4l only). Everything is
> fine in 2.4.x. With 2.6, programs using v4l2 works ok (xawtv, ...); and programs
> using v4l crash:

> Aug 25 19:20:19 zain kernel: kernel BUG at drivers/media/video/bttv-driver.c:1900!

Missing sanity check, overlay is supported for packed pixel formats
only. Patch below. It's not API related btw, the bug can be triggered
using the v4l2 API as well.

Gerd

diff -u linux-2.6.9-rc1/drivers/media/video/bttv-driver.c linux/drivers/media/video/bttv-driver.c
--- linux-2.6.9-rc1/drivers/media/video/bttv-driver.c 2004-08-25 18:23:10.000000000 +0200
+++ linux/drivers/media/video/bttv-driver.c 2004-08-30 14:42:43.321218189 +0200
@@ -1861,6 +1861,8 @@

if (NULL == fh->ovfmt)
return -EINVAL;
+ if (!(fh->ovfmt->flags & FORMAT_FLAGS_PACKED))
+ return -EINVAL;
retval = verify_window(&bttv_tvnorms[btv->tvnorm],win,fixup);
if (0 != retval)
return retval;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/