]> git.baikalelectronics.ru Git - kernel.git/commit
V4L/DVB: Fix VIDIOC_QBUF compat ioctl32
authorArnaud Patard <apatard@mandriva.com>
Mon, 25 Jan 2010 15:02:31 +0000 (12:02 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:10:49 +0000 (15:10 -0300)
commitcfed7669a570a1d39400aaea4af1929176b8bd45
tree0257f38579b7055c8a5163d9961865726e95616f
parente3b8a6c5de217f803bc4c75b50f3419b4a19b91c
V4L/DVB: Fix VIDIOC_QBUF compat ioctl32

When using VIDIOC_QBUF with memory type set to V4L2_MEMORY_MMAP, the
v4l2_buffer buffer gets unmodified on drivers like uvc (well, only
bytesused field is modified). Then some apps like gstreamer are reusing
the same buffer later to call munmap (eg passing the buffer "length"
field as 2nd parameter of munmap).

It's working fine on full 32bits but on 32bits systems with 64bit
kernel, the get_v4l2_buffer32() doesn't copy length/m.offset values and
then copy garbage to userspace in put_v4l2_buffer32().

This has for consequence things like that in the libv4l2 logs:

libv4l2: v4l2 unknown munmap 0x2e2b0000, -2145144908
libv4l2: v4l2 unknown munmap 0x2e530000, -2145144908

The buffer are not unmap'ed and then if the application close and open
again the device, it won't work and logs will show something like:

libv4l2: error setting pixformat: Device or resource busy

The easy solution is to read length and m.offset in get_v4l2_buffer32().

Signed-off-by: Arnaud Patard <apatard@mandriva.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-compat-ioctl32.c