The patch number 14083 was added via Douglas Schilling Landgraf <dougsl...@redhat.com> to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward compatible with older kernels. Compatibility modifications will be removed before inclusion into the mainstream Kernel If anyone has any objections, please let us know by sending a message to: Linux Media Mailing List <linux-me...@vger.kernel.org> ------ From: Arnaud Patard <apat...@mandriva.com> 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(). Priority: normal Signed-off-by: Arnaud Patard <apat...@mandriva.com> Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com> Signed-off-by: Douglas Schilling Landgraf <dougsl...@redhat.com> --- linux/drivers/media/video/v4l2-compat-ioctl32.c | 3 +++ 1 file changed, 3 insertions(+) diff -r a7155123d4a3 -r 8bf74a0eb35d linux/drivers/media/video/v4l2-compat-ioctl32.c --- a/linux/drivers/media/video/v4l2-compat-ioctl32.c Mon Feb 01 15:33:36 2010 -0200 +++ b/linux/drivers/media/video/v4l2-compat-ioctl32.c Mon Feb 01 15:36:08 2010 -0200 @@ -480,6 +480,9 @@ return -EFAULT; switch (kp->memory) { case V4L2_MEMORY_MMAP: + if (get_user(kp->length, &up->length) || + get_user(kp->m.offset, &up->m.offset)) + return -EFAULT; break; case V4L2_MEMORY_USERPTR: { --- Patch is available at: http://linuxtv.org/hg/v4l-dvb/rev/8bf74a0eb35d77f950c1b45e469742f24293c84f _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits