1. 15 4月, 2021 1 次提交
    • H
      media: v4l2-ctrls: fix reference to freed memory · ac34b79d
      Hans Verkuil 提交于
      When controls are used together with the Request API, then for
      each request a v4l2_ctrl_handler struct is allocated. This contains
      the controls that can be set in a request. If a control is *not* set in
      the request, then the value used in the most recent previous request
      must be used, or the current value if it is not found in any outstanding
      requests.
      
      The framework tried to find such a previous request and it would set
      the 'req' pointer in struct v4l2_ctrl_ref to the v4l2_ctrl_ref of the
      control in such a previous request. So far, so good. However, when that
      previous request was applied to the hardware, returned to userspace, and
      then userspace would re-init or free that request, any 'ref' pointer in
      still-queued requests would suddenly point to freed memory.
      
      This was not noticed before since the drivers that use this expected
      that each request would always have the controls set, so there was
      never any need to find a control in older requests. This requirement
      was relaxed, and now this bug surfaced.
      
      It was also made worse by changeset
      2fae4d6a ("media: v4l2-ctrls: v4l2_ctrl_request_complete() should always set ref->req")
      which increased the chance of this happening.
      
      The use of the 'req' pointer in v4l2_ctrl_ref was very fragile, so
      drop this entirely. Instead add a valid_p_req bool to indicate that
      p_req contains a valid value for this control. And if it is false,
      then just use the current value of the control.
      
      Note that VIDIOC_G_EXT_CTRLS will always return -EACCES when attempting
      to get a control from a request until the request is completed. And in
      that case, all controls in the request will have the control value set
      (i.e. valid_p_req is true). This means that the whole 'find the most
      recent previous request containing a control' idea is pointless, and
      the code can be simplified considerably.
      
      The v4l2_g_ext_ctrls_common() function was refactored a bit to make
      it more understandable. It also avoids updating volatile controls
      in a completed request since that was already done when the request
      was completed.
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Fixes: 2fae4d6a ("media: v4l2-ctrls: v4l2_ctrl_request_complete() should always set ref->req")
      Fixes: 6fa6f831 ("media: v4l2-ctrls: add core request support")
      Cc: <stable@vger.kernel.org>      # for v5.9 and up
      Tested-by: NAlexandre Courbot <acourbot@chromium.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      ac34b79d
  2. 06 4月, 2021 7 次提交
  3. 22 3月, 2021 14 次提交
  4. 11 3月, 2021 3 次提交
    • L
      media: v4l2-mc: Add link flags to v4l2_create_fwnode_links_to_pad() · dbedd2f4
      Laurent Pinchart 提交于
      Add a flags argument to the v4l2_create_fwnode_links_to_pad() function
      to specify the link flags. This allows drivers to create immutable links
      for instance.
      Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: NRui Miguel Silva <rmfrfs@gmail.com>
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      dbedd2f4
    • H
      media: fix incorrect kernel doc usages · a4184b4f
      Hans Verkuil 提交于
      This patch fixes the following trivial warnings w.r.t. kernel-doc usage:
      
      drivers/media/common/videobuf2/frame_vector.c:38: warning: Excess function parameter 'gup_flags' description in 'get_vaddr_frames'
      drivers/media/dvb-core/dvb_ca_en50221.c:193: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1014: warning: expecting prototype for Wake up the DVB CA thread(). Prototype was for
      dvb_ca_en50221_thread_wakeup() instead
      drivers/media/dvb-core/dvb_ca_en50221.c:1023: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1081: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1112: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1327: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1411: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1426: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1582: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1693: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1743: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1772: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1830: warning: wrong kernel-doc identifier on line:
      drivers/media/dvb-core/dvb_ca_en50221.c:1922: warning: wrong kernel-doc identifier on line:
      drivers/media/rc/img-ir/img-ir-hw.c:628: warning: expecting prototype for img_ir_decoder_compatable(). Prototype was for
      img_ir_decoder_compatible() instead
      drivers/media/v4l2-core/v4l2-jpeg.c:461: warning: expecting prototype for jpeg_parse_header(). Prototype was for v4l2_jpeg_parse_header()
      instead
      drivers/media/platform/vsp1/vsp1_dl.c:166: warning: expecting prototype for struct vsp1_cmd_pool. Prototype was for struct vsp1_dl_cmd_pool
      instead
      drivers/media/platform/mtk-vpu/mtk_vpu.c:28: warning: expecting prototype for is a tiny processor controlling video hardware(). Prototype
      was for INIT_TIMEOUT_MS() instead
      drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c:73: warning: expecting prototype for struct vp9_fb_info. Prototype was for struct
      vp9_ref_buf instead
      drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c:85: warning: expecting prototype for struct vp9_fb_info. Prototype was for struct
      vp9_sf_ref_fb instead
      drivers/media/tuners/mt2063.c:1404: warning: expecting prototype for fLO_FractionalTerm(). Prototype was for MT2063_fLO_FractionalTerm() instead
      drivers/media/tuners/mt2063.c:1465: warning: expecting prototype for CalcLO2Mult(). Prototype was for MT2063_CalcLO2Mult() instead
      drivers/media/usb/pwc/pwc-dec23.c:640: warning: wrong kernel-doc identifier on line:
      drivers/media/platform/exynos4-is/media-dev.c:820: warning: expecting prototype for __fimc_md_create_fimc_links(). Prototype was for
      __fimc_md_create_fimc_sink_links() instead
      drivers/media/i2c/s5k6aa.c:426: warning: expecting prototype for s5k6aa_configure_pixel_clock(). Prototype was for
      s5k6aa_configure_pixel_clocks() instead
      drivers/media/i2c/imx274.c:700: warning: wrong kernel-doc identifier on line:
      drivers/media/i2c/imx274.c:735: warning: wrong kernel-doc identifier on line:
      drivers/media/i2c/imx274.c:983: warning: wrong kernel-doc identifier on line:
      
      Most are missing or mistyped function names.
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      a4184b4f
    • A
      media: v4l: common: v4l2_get_link_freq: add printing a warning · 67012d97
      Andrey Konovalov 提交于
      Print a warning if V4L2_CID_LINK_FREQ control is not implemented.
      Signed-off-by: NAndrey Konovalov <andrey.konovalov@linaro.org>
      Reviewed-by: NJacopo Mondi <jacopo@jmondi.org>
      Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      67012d97
  5. 06 2月, 2021 5 次提交
  6. 27 1月, 2021 7 次提交
  7. 14 1月, 2021 3 次提交