This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: v4l2-compliance: add kernel version check to avoid kernel oops
Author:  Hans Verkuil <[email protected]>
Date:    Sun Jan 16 18:52:07 2011 +0100

Due to a bug in kernels <= 2.6.37 the kernel can crash if an attempt is made
to set a control of type CTRL_CLASS. Don't do this on such kernels.

Signed-off-by: Hans Verkuil <[email protected]>

 utils/v4l2-compliance/v4l2-compliance.cpp    |   15 ++++++++++++++-
 utils/v4l2-compliance/v4l2-compliance.h      |    1 +
 utils/v4l2-compliance/v4l2-test-controls.cpp |    7 ++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=49d9c5173709462d2e820eef9298f1aa5c526308

diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp 
b/utils/v4l2-compliance/v4l2-compliance.cpp
index 03a4cf9..34edab4 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -33,6 +33,7 @@
 #include <sys/time.h>
 #include <math.h>
 #include <sys/klog.h>
+#include <sys/utsname.h>
 
 #include "v4l2-compliance.h"
 
@@ -62,9 +63,10 @@ static int tests_total, tests_ok;
 
 // Globals
 int verbose;
+int wrapper;
+int kernel_version;
 unsigned caps;
 unsigned warnings;
-int wrapper;
 
 static struct option long_options[] = {
        {"device", required_argument, 0, OptSetDevice},
@@ -374,6 +376,14 @@ int main(int argc, char **argv)
        verbose = options[OptVerbose];
        wrapper = options[OptUseWrapper];
 
+       struct utsname uts;
+       int v1, v2, v3;
+
+       uname(&uts);
+       sscanf(uts.release, "%d.%d.%d", &v1, &v2, &v3);
+       if (v1 == 2 && v2 == 6)
+               kernel_version = v3;
+
        if (!video_device && !radio_device && !vbi_device)
                video_device = "/dev/video0";
 
@@ -422,6 +432,9 @@ int main(int argc, char **argv)
 
        /* Information Opts */
 
+       if (kernel_version)
+               printf("Running on 2.6.%d\n\n", kernel_version);
+
        printf("Driver Info:\n");
        printf("\tDriver name   : %s\n", vcap.driver);
        printf("\tCard type     : %s\n", vcap.card);
diff --git a/utils/v4l2-compliance/v4l2-compliance.h 
b/utils/v4l2-compliance/v4l2-compliance.h
index 3575f4d..cfa2c1f 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -28,6 +28,7 @@
 
 extern int verbose;
 extern int wrapper;
+extern int kernel_version;
 extern unsigned caps;
 extern unsigned warnings;
 
diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp 
b/utils/v4l2-compliance/v4l2-test-controls.cpp
index 1678441..1e915dc 100644
--- a/utils/v4l2-compliance/v4l2-test-controls.cpp
+++ b/utils/v4l2-compliance/v4l2-test-controls.cpp
@@ -309,7 +309,12 @@ int testSimpleControls(struct node *node)
                                return fail("g_ctrl allowed for unsupported 
type\n");
                        ctrl.id = iter->id;
                        ctrl.value = 0;
-                       ret = doioctl(node, VIDIOC_S_CTRL, &ctrl);
+                       // This call will crash on kernels <= 2.6.37 for 
control classes due to
+                       // a bug in v4l2-ctrls.c. So skip this on those kernels.
+                       if (kernel_version < 38 && iter->type == 
V4L2_CTRL_TYPE_CTRL_CLASS)
+                               ret = EACCES;
+                       else
+                               ret = doioctl(node, VIDIOC_S_CTRL, &ctrl);
                        if (ret != EINVAL &&
                            !((iter->flags & V4L2_CTRL_FLAG_READ_ONLY) && ret 
== EACCES))
                                return fail("s_ctrl allowed for unsupported 
type\n");

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to