1. 25 6月, 2006 2 次提交
    • J
      V4L/DVB (4154): Fix use-after-free bug in cpia2 driver · bafefc0c
      Jesper Juhl 提交于
      The coverity checker detected a use-after-free error in
      drivers/media/video/cpia2/cpia2_v4l.c::cpia2_close() (coverity
      error #1281).
      What happens is that we lock cam->busy_lock, then proceed to free
      resources, and in the case of (--cam->open_count == 0) we finish off by
      doing a kfree(cam) and then at the end of the function we do a
      mutex_unlock(&cam->busy_lock) which will explode since it'll dereference
      the free'd `cam' :
      ...
      mutex_lock(&cam->busy_lock);
      ...
      if (--cam->open_count == 0) {
          ...
          if (!cam->present) {
              video_unregister_device(dev);
              kfree(cam);
          }
      }
      mutex_unlock(&cam->busy_lock);   <--- PROBLEM, cam no longer around.
      ...
      Since this only happens in the case of open_count going down to zero I
      don't see a problem with just releasing the mutex after unregistering the
      device and just before the kfree().  In this case there is nothing around
      that we can race against; we are in the release method, open_count is zero,
      (!cam->present) and the device has just been unregistered, so letting go of
      the mutex at this point looks safe to me.
      Patch below to implement that solution.
      Acked-by: NRandy Dunlap <rdunlap@xenotime.net>
      Signed-off-by: NJesper Juhl <jesper.juhl@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
      bafefc0c
    • T
      657de3cd
  2. 25 3月, 2006 1 次提交
  3. 08 3月, 2006 1 次提交
  4. 03 3月, 2006 1 次提交
  5. 27 2月, 2006 1 次提交
    • A
      V4L/DVB (3376): Add cpia2 camera support · ab33d507
      Alan Cox 提交于
      There has been a CPIA2 driver out of kernel for a long time and it has
      been pretty clean for some time too. This is an import of the
      sourceforge driver which has been stripped of
      - 2.4 back compatibility
      - 2.4 old style MJPEG ioctls
      A couple of functions have been made static and the docs have been
      repackaged into Documentation/video4linux.  The rvmalloc/free functions now
      match the cpia driver again.  Other than that this is the code as is.
      Tested on x86-64 with a QX5 microscope.
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
      ab33d507