]> git.karo-electronics.de Git - linux-beck.git/commit
[media] v4l2-ioctl: Don't assume file->private_data always points to a v4l2_fh
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 7 Jul 2012 19:11:11 +0000 (16:11 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Jul 2012 21:44:07 +0000 (18:44 -0300)
commit7a3ed2d95e9ef3032700c2e56f3369d8652a6e8b
tree0035dbe254fbbbab4a5718b3f3a1d73db968720d
parenta2f8b84fed92d56c3891d03f090601c53766b118
[media] v4l2-ioctl: Don't assume file->private_data always points to a v4l2_fh

Commit efbceecd4522a41b8442c6b4f68b4508d57d1ccf, adds a number of helper
functions for ctrl related ioctls to v4l2-ioctl.c, these helpers assume that
if file->private_data != NULL, it points to a v4l2_fh, which is only the case
for drivers which actually use v4l2_fh.

This breaks for example bttv which use the "filedata" pointer for its own uses,
and now all the ctrl ioctls try to use whatever its filedata points to as
v4l2_fh and think it has a ctrl_handler, leading to:

[  142.499214] BUG: unable to handle kernel NULL pointer dereference at 0000000000000021
[  142.499270] IP: [<ffffffffa01cb959>] v4l2_queryctrl+0x29/0x230 [videodev]
[  142.514649]  [<ffffffffa01c7a77>] v4l_queryctrl+0x47/0x90 [videodev]
[  142.517417]  [<ffffffffa01c58b1>] __video_do_ioctl+0x2c1/0x420 [videodev]
[  142.520116]  [<ffffffffa01c7ee6>] video_usercopy+0x1a6/0x470 [videodev]
...

This patch adds the missing test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) tests
to the ctrl ioctl helpers v4l2_fh paths, fixing the issues with for example
the bttv driver.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-ioctl.c