Skip to content

Commit d67614f

Browse files
committed
Merge fixes into media_stage
* 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
2 parents 70a7ce2 + 3a99c44 commit d67614f

File tree

6 files changed

+33
-17
lines changed

6 files changed

+33
-17
lines changed

drivers/media/dvb-core/dvb_vb2.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,12 @@ int dvb_vb2_reqbufs(struct dvb_vb2_ctx *ctx, struct dmx_requestbuffers *req)
354354

355355
int dvb_vb2_querybuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b)
356356
{
357+
struct vb2_queue *q = &ctx->vb_q;
358+
359+
if (b->index >= q->num_buffers) {
360+
dprintk(1, "[%s] buffer index out of range\n", ctx->name);
361+
return -EINVAL;
362+
}
357363
vb2_core_querybuf(&ctx->vb_q, b->index, b);
358364
dprintk(3, "[%s] index=%d\n", ctx->name, b->index);
359365
return 0;
@@ -378,8 +384,13 @@ int dvb_vb2_expbuf(struct dvb_vb2_ctx *ctx, struct dmx_exportbuffer *exp)
378384

379385
int dvb_vb2_qbuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b)
380386
{
387+
struct vb2_queue *q = &ctx->vb_q;
381388
int ret;
382389

390+
if (b->index >= q->num_buffers) {
391+
dprintk(1, "[%s] buffer index out of range\n", ctx->name);
392+
return -EINVAL;
393+
}
383394
ret = vb2_core_qbuf(&ctx->vb_q, b->index, b, NULL);
384395
if (ret) {
385396
dprintk(1, "[%s] index=%d errno=%d\n", ctx->name,

drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,11 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
273273
}
274274

275275
dev->enc_irq = platform_get_irq(pdev, 0);
276+
if (dev->enc_irq < 0) {
277+
ret = dev->enc_irq;
278+
goto err_res;
279+
}
280+
276281
irq_set_status_flags(dev->enc_irq, IRQ_NOAUTOEN);
277282
ret = devm_request_irq(&pdev->dev, dev->enc_irq,
278283
mtk_vcodec_enc_irq_handler,

drivers/media/usb/uvc/uvc_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2740,7 +2740,7 @@ static const struct usb_device_id uvc_ids[] = {
27402740
.idProduct = 0x4034,
27412741
.bInterfaceClass = USB_CLASS_VIDEO,
27422742
.bInterfaceSubClass = 1,
2743-
.bInterfaceProtocol = 0,
2743+
.bInterfaceProtocol = UVC_PC_PROTOCOL_15,
27442744
.driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
27452745
/* LogiLink Wireless Webcam */
27462746
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE

drivers/media/v4l2-core/v4l2-compat-ioctl32.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,8 @@ int v4l2_compat_get_array_args(struct file *file, void *mbuf,
10401040
{
10411041
int err = 0;
10421042

1043+
memset(mbuf, 0, array_size);
1044+
10431045
switch (cmd) {
10441046
case VIDIOC_G_FMT32:
10451047
case VIDIOC_S_FMT32:

drivers/media/v4l2-core/v4l2-ioctl.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,9 +2872,9 @@ static const struct v4l2_ioctl_info v4l2_ioctls[] = {
28722872
IOCTL_INFO(VIDIOC_S_PRIORITY, v4l_s_priority, v4l_print_u32, INFO_FL_PRIO),
28732873
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)),
28742874
IOCTL_INFO(VIDIOC_LOG_STATUS, v4l_log_status, v4l_print_newline, 0),
2875-
IOCTL_INFO(VIDIOC_G_EXT_CTRLS, v4l_g_ext_ctrls, v4l_print_ext_controls, INFO_FL_CTRL),
2876-
IOCTL_INFO(VIDIOC_S_EXT_CTRLS, v4l_s_ext_ctrls, v4l_print_ext_controls, INFO_FL_PRIO | INFO_FL_CTRL),
2877-
IOCTL_INFO(VIDIOC_TRY_EXT_CTRLS, v4l_try_ext_ctrls, v4l_print_ext_controls, INFO_FL_CTRL),
2875+
IOCTL_INFO(VIDIOC_G_EXT_CTRLS, v4l_g_ext_ctrls, v4l_print_ext_controls, INFO_FL_CTRL | INFO_FL_ALWAYS_COPY),
2876+
IOCTL_INFO(VIDIOC_S_EXT_CTRLS, v4l_s_ext_ctrls, v4l_print_ext_controls, INFO_FL_PRIO | INFO_FL_CTRL | INFO_FL_ALWAYS_COPY),
2877+
IOCTL_INFO(VIDIOC_TRY_EXT_CTRLS, v4l_try_ext_ctrls, v4l_print_ext_controls, INFO_FL_CTRL | INFO_FL_ALWAYS_COPY),
28782878
IOCTL_INFO(VIDIOC_ENUM_FRAMESIZES, v4l_stub_enum_framesizes, v4l_print_frmsizeenum, INFO_FL_CLEAR(v4l2_frmsizeenum, pixel_format)),
28792879
IOCTL_INFO(VIDIOC_ENUM_FRAMEINTERVALS, v4l_stub_enum_frameintervals, v4l_print_frmivalenum, INFO_FL_CLEAR(v4l2_frmivalenum, height)),
28802880
IOCTL_INFO(VIDIOC_G_ENC_INDEX, v4l_stub_g_enc_index, v4l_print_enc_idx, 0),
@@ -3367,8 +3367,7 @@ video_usercopy(struct file *file, unsigned int orig_cmd, unsigned long arg,
33673367
array_buf = kvmalloc(array_size, GFP_KERNEL);
33683368
err = -ENOMEM;
33693369
if (array_buf == NULL)
3370-
goto out_array_args;
3371-
err = -EFAULT;
3370+
goto out;
33723371
if (in_compat_syscall())
33733372
err = v4l2_compat_get_array_args(file, array_buf,
33743373
user_ptr, array_size,
@@ -3377,7 +3376,7 @@ video_usercopy(struct file *file, unsigned int orig_cmd, unsigned long arg,
33773376
err = copy_from_user(array_buf, user_ptr, array_size) ?
33783377
-EFAULT : 0;
33793378
if (err)
3380-
goto out_array_args;
3379+
goto out;
33813380
*kernel_ptr = array_buf;
33823381
}
33833382

@@ -3395,6 +3394,13 @@ video_usercopy(struct file *file, unsigned int orig_cmd, unsigned long arg,
33953394
trace_v4l2_qbuf(video_devdata(file)->minor, parg);
33963395
}
33973396

3397+
/*
3398+
* Some ioctls can return an error, but still have valid
3399+
* results that must be returned.
3400+
*/
3401+
if (err < 0 && !always_copy)
3402+
goto out;
3403+
33983404
if (has_array_args) {
33993405
*kernel_ptr = (void __force *)user_ptr;
34003406
if (in_compat_syscall()) {
@@ -3409,16 +3415,8 @@ video_usercopy(struct file *file, unsigned int orig_cmd, unsigned long arg,
34093415
} else if (copy_to_user(user_ptr, array_buf, array_size)) {
34103416
err = -EFAULT;
34113417
}
3412-
goto out_array_args;
34133418
}
3414-
/*
3415-
* Some ioctls can return an error, but still have valid
3416-
* results that must be returned.
3417-
*/
3418-
if (err < 0 && !always_copy)
3419-
goto out;
34203419

3421-
out_array_args:
34223420
if (video_put_user((void __user *)arg, parg, cmd, orig_cmd))
34233421
err = -EFAULT;
34243422
out:

drivers/staging/media/rkvdec/rkvdec-h264.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,8 +1162,8 @@ static int rkvdec_h264_run(struct rkvdec_ctx *ctx)
11621162

11631163
schedule_delayed_work(&rkvdec->watchdog_work, msecs_to_jiffies(2000));
11641164

1165-
writel(0xffffffff, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN);
1166-
writel(0xffffffff, rkvdec->regs + RKVDEC_REG_H264_ERR_E);
1165+
writel(0, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN);
1166+
writel(0, rkvdec->regs + RKVDEC_REG_H264_ERR_E);
11671167
writel(1, rkvdec->regs + RKVDEC_REG_PREF_LUMA_CACHE_COMMAND);
11681168
writel(1, rkvdec->regs + RKVDEC_REG_PREF_CHR_CACHE_COMMAND);
11691169

0 commit comments

Comments
 (0)