]> Git Repo - linux.git/commitdiff
Merge fixes into media_stage
authorMauro Carvalho Chehab <[email protected]>
Tue, 27 Sep 2022 08:27:48 +0000 (10:27 +0200)
committerMauro Carvalho Chehab <[email protected]>
Tue, 27 Sep 2022 08:27:56 +0000 (10:27 +0200)
* fixes:
  media: rkvdec: Disable H.264 error detection
  media: mediatek: vcodec: Drop platform_get_resource(IORESOURCE_IRQ)
  media: dvb_vb2: fix possible out of bound access
  media: v4l2-ioctl.c: fix incorrect error path
  media: v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args()
  media: uvcvideo: Fix InterfaceProtocol for Quanta camera

1  2 
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
drivers/media/usb/uvc/uvc_driver.c
drivers/media/v4l2-core/v4l2-ioctl.c

index 0abe1dac75b3a7516e40cf3d1d500133b97b6247,d2f5f30582a9ce7236275da4d76009ebef264774..9095186d549533a1c1b33e162c9641129b2a4c02
@@@ -130,7 -130,6 +130,7 @@@ static int fops_vcodec_open(struct fil
        INIT_LIST_HEAD(&ctx->list);
        ctx->dev = dev;
        init_waitqueue_head(&ctx->queue[0]);
 +      mutex_init(&ctx->q_mutex);
  
        ctx->type = MTK_INST_ENCODER;
        ret = mtk_vcodec_enc_ctrls_setup(ctx);
@@@ -273,6 -272,11 +273,11 @@@ static int mtk_vcodec_probe(struct plat
        }
  
        dev->enc_irq = platform_get_irq(pdev, 0);
+       if (dev->enc_irq < 0) {
+               ret = dev->enc_irq;
+               goto err_res;
+       }
        irq_set_status_flags(dev->enc_irq, IRQ_NOAUTOEN);
        ret = devm_request_irq(&pdev->dev, dev->enc_irq,
                               mtk_vcodec_enc_irq_handler,
@@@ -399,18 -403,6 +404,18 @@@ static const struct mtk_vcodec_enc_pdat
        .core_id = VENC_SYS,
  };
  
 +static const struct mtk_vcodec_enc_pdata mt8188_pdata = {
 +      .uses_ext = true,
 +      .capture_formats = mtk_video_formats_capture_h264,
 +      .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264),
 +      .output_formats = mtk_video_formats_output,
 +      .num_output_formats = ARRAY_SIZE(mtk_video_formats_output),
 +      .min_bitrate = 64,
 +      .max_bitrate = 50000000,
 +      .core_id = VENC_SYS,
 +      .uses_34bit = true,
 +};
 +
  static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
        .uses_ext = true,
        .capture_formats = mtk_video_formats_capture_h264,
@@@ -439,7 -431,6 +444,7 @@@ static const struct of_device_id mtk_vc
        {.compatible = "mediatek,mt8173-vcodec-enc-vp8",
                        .data = &mt8173_vp8_pdata},
        {.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
 +      {.compatible = "mediatek,mt8188-vcodec-enc", .data = &mt8188_pdata},
        {.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
        {.compatible = "mediatek,mt8195-vcodec-enc", .data = &mt8195_pdata},
        {},
index 639fd7bab5d5fd4c12e1169e9ae0e9ce4207647c,d509a4a2f08e983a335d69e101d727a8179ab48e..744051b52e1246005e9586a8a971fe27b7583f3f
@@@ -1553,6 -1553,10 +1553,6 @@@ static int uvc_gpio_parse(struct uvc_de
        if (IS_ERR_OR_NULL(gpio_privacy))
                return PTR_ERR_OR_ZERO(gpio_privacy);
  
 -      unit = uvc_alloc_entity(UVC_EXT_GPIO_UNIT, UVC_EXT_GPIO_UNIT_ID, 0, 1);
 -      if (!unit)
 -              return -ENOMEM;
 -
        irq = gpiod_to_irq(gpio_privacy);
        if (irq < 0) {
                if (irq != EPROBE_DEFER)
                return irq;
        }
  
 +      unit = uvc_alloc_entity(UVC_EXT_GPIO_UNIT, UVC_EXT_GPIO_UNIT_ID, 0, 1);
 +      if (!unit)
 +              return -ENOMEM;
 +
        unit->gpio.gpio_privacy = gpio_privacy;
        unit->gpio.irq = irq;
        unit->gpio.bControlSize = 1;
@@@ -2740,7 -2740,7 +2740,7 @@@ static const struct usb_device_id uvc_i
          .idProduct            = 0x4034,
          .bInterfaceClass      = USB_CLASS_VIDEO,
          .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
+         .bInterfaceProtocol   = UVC_PC_PROTOCOL_15,
          .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
        /* LogiLink Wireless Webcam */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0,
          .driver_info          = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_BPP) },
 +      /* Sonix Technology USB 2.0 Camera */
 +      { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
 +                              | USB_DEVICE_ID_MATCH_INT_INFO,
 +        .idVendor             = 0x3277,
 +        .idProduct            = 0x0072,
 +        .bInterfaceClass      = USB_CLASS_VIDEO,
 +        .bInterfaceSubClass   = 1,
 +        .bInterfaceProtocol   = 0,
 +        .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
        /* Acer EasyCamera */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
index a1a1b51ac599a82e2a955607966e7c1050bf9a38,e6fd355a2e92ce3f0361866181b620a913ff4f4d..fddba75d90745811d6936090af252881ed248c73
@@@ -1045,7 -1045,7 +1045,7 @@@ static void v4l_sanitize_format(struct 
        /*
         * The v4l2_pix_format structure has been extended with fields that were
         * not previously required to be set to zero by applications. The priv
 -       * field, when set to a magic value, indicates the the extended fields
 +       * field, when set to a magic value, indicates that the extended fields
         * are valid. Otherwise they will contain undefined values. To simplify
         * the API towards drivers zero the extended fields and set the priv
         * field to the magic value when the extended pixel format structure
@@@ -2872,9 -2872,9 +2872,9 @@@ static const struct v4l2_ioctl_info v4l
        IOCTL_INFO(VIDIOC_S_PRIORITY, v4l_s_priority, v4l_print_u32, INFO_FL_PRIO),
        IOCTL_INFO(VIDIOC_G_SLICED_VBI_CAP, v4l_g_sliced_vbi_cap, v4l_print_sliced_vbi_cap, INFO_FL_CLEAR(v4l2_sliced_vbi_cap, type)),
        IOCTL_INFO(VIDIOC_LOG_STATUS, v4l_log_status, v4l_print_newline, 0),
-       IOCTL_INFO(VIDIOC_G_EXT_CTRLS, v4l_g_ext_ctrls, v4l_print_ext_controls, INFO_FL_CTRL),
-       IOCTL_INFO(VIDIOC_S_EXT_CTRLS, v4l_s_ext_ctrls, v4l_print_ext_controls, INFO_FL_PRIO | INFO_FL_CTRL),
-       IOCTL_INFO(VIDIOC_TRY_EXT_CTRLS, v4l_try_ext_ctrls, v4l_print_ext_controls, INFO_FL_CTRL),
+       IOCTL_INFO(VIDIOC_G_EXT_CTRLS, v4l_g_ext_ctrls, v4l_print_ext_controls, INFO_FL_CTRL | INFO_FL_ALWAYS_COPY),
+       IOCTL_INFO(VIDIOC_S_EXT_CTRLS, v4l_s_ext_ctrls, v4l_print_ext_controls, INFO_FL_PRIO | INFO_FL_CTRL | INFO_FL_ALWAYS_COPY),
+       IOCTL_INFO(VIDIOC_TRY_EXT_CTRLS, v4l_try_ext_ctrls, v4l_print_ext_controls, INFO_FL_CTRL | INFO_FL_ALWAYS_COPY),
        IOCTL_INFO(VIDIOC_ENUM_FRAMESIZES, v4l_stub_enum_framesizes, v4l_print_frmsizeenum, INFO_FL_CLEAR(v4l2_frmsizeenum, pixel_format)),
        IOCTL_INFO(VIDIOC_ENUM_FRAMEINTERVALS, v4l_stub_enum_frameintervals, v4l_print_frmivalenum, INFO_FL_CLEAR(v4l2_frmivalenum, height)),
        IOCTL_INFO(VIDIOC_G_ENC_INDEX, v4l_stub_g_enc_index, v4l_print_enc_idx, 0),
@@@ -3367,8 -3367,7 +3367,7 @@@ video_usercopy(struct file *file, unsig
                array_buf = kvmalloc(array_size, GFP_KERNEL);
                err = -ENOMEM;
                if (array_buf == NULL)
-                       goto out_array_args;
-               err = -EFAULT;
+                       goto out;
                if (in_compat_syscall())
                        err = v4l2_compat_get_array_args(file, array_buf,
                                                         user_ptr, array_size,
                        err = copy_from_user(array_buf, user_ptr, array_size) ?
                                                                -EFAULT : 0;
                if (err)
-                       goto out_array_args;
+                       goto out;
                *kernel_ptr = array_buf;
        }
  
                        trace_v4l2_qbuf(video_devdata(file)->minor, parg);
        }
  
+       /*
+        * Some ioctls can return an error, but still have valid
+        * results that must be returned.
+        */
+       if (err < 0 && !always_copy)
+               goto out;
        if (has_array_args) {
                *kernel_ptr = (void __force *)user_ptr;
                if (in_compat_syscall()) {
                } else if (copy_to_user(user_ptr, array_buf, array_size)) {
                        err = -EFAULT;
                }
-               goto out_array_args;
        }
-       /*
-        * Some ioctls can return an error, but still have valid
-        * results that must be returned.
-        */
-       if (err < 0 && !always_copy)
-               goto out;
  
- out_array_args:
        if (video_put_user((void __user *)arg, parg, cmd, orig_cmd))
                err = -EFAULT;
  out:
This page took 0.128788 seconds and 4 git commands to generate.