1. 24 Apr, 2024 4 commits
    • Hans Verkuil's avatar
      media: videobuf2: improve max_num_buffers sanity checks · 1df7b8cd
      Hans Verkuil authored
      Ensure that drivers set max_num_buffers to a value >= 32.
      For now there is no reason for drivers to request a lower
      limit and doing so might potentially cause userspace issues.
      Note that the old check of > MAX_BUFFER_INDEX was pointless
      since q->max_num_buffers was already limited to MAX_BUFFER_INDEX
      or less.
      
      Also add a sanity check in __vb2_init_fileio(), returning
      -ENOSPC if a driver returns more than 32 buffers from
      VIDIOC_REQBUFS with count = q->min_reqbufs_allocation.
      
      The vb2_fileio_data struct only supports up to 32 buffers,
      so we need a check there.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      1df7b8cd
    • Hans Verkuil's avatar
      doc: media: v4l/func-open.rst: ENXIO should be ENODEV · e85bfd15
      Hans Verkuil authored
      The error that V4L2 returns when an attempt is made to open an
      unregisted device node is ENODEV, no ENXIO. Update the documentation.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      e85bfd15
    • Hans Verkuil's avatar
      media: cec: return -ENODEV instead of -ENXIO if unregistered · dd05fd12
      Hans Verkuil authored
      If the CEC device is unregistered, then an attempt to open
      the device node should result in an -ENODEV error instead of
      -ENXIO.
      
      Document this as well in cec-func-open.rst.
      
      This is consistent with the error code returned by other
      file operations such as ioctl.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      dd05fd12
    • Hans Verkuil's avatar
      media: v4l2-core: hold videodev_lock until dev reg, finishes · 1ed4477f
      Hans Verkuil authored
      After the new V4L2 device node was registered, some additional
      initialization was done before the device node was marked as
      'registered'. During the time between creating the device node
      and marking it as 'registered' it was possible to open the
      device node, which would return -ENODEV since the 'registered'
      flag was not yet set.
      
      Hold the videodev_lock mutex from just before the device node
      is registered until the 'registered' flag is set. Since v4l2_open
      will take the same lock, it will wait until this registration
      process is finished. This resolves this race condition.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Reviewed-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Cc: <stable@vger.kernel.org>      # for vi4.18 and up
      1ed4477f
  2. 22 Apr, 2024 27 commits
  3. 19 Apr, 2024 5 commits
  4. 15 Apr, 2024 4 commits