Commit 2339e91d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'media/v5.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:

 - a regression fix at v4l2 core, with affects multi-plane streams

 - a fix at vim2m driver

* tag 'media/v5.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  media: vim2m: only cancel work if it is for right context
  media: v4l: ioctl: Validate num_planes for debug messages
  media: v4l: ioctl: Validate num_planes before using it
  media: v4l2-ioctl: Clear only per-plane reserved fields
parents d28f3e72 240809ef
...@@ -807,7 +807,9 @@ static void vim2m_stop_streaming(struct vb2_queue *q) ...@@ -807,7 +807,9 @@ static void vim2m_stop_streaming(struct vb2_queue *q)
struct vb2_v4l2_buffer *vbuf; struct vb2_v4l2_buffer *vbuf;
unsigned long flags; unsigned long flags;
cancel_delayed_work_sync(&dev->work_run); if (v4l2_m2m_get_curr_priv(dev->m2m_dev) == ctx)
cancel_delayed_work_sync(&dev->work_run);
for (;;) { for (;;) {
if (V4L2_TYPE_IS_OUTPUT(q->type)) if (V4L2_TYPE_IS_OUTPUT(q->type))
vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
......
...@@ -287,6 +287,7 @@ static void v4l_print_format(const void *arg, bool write_only) ...@@ -287,6 +287,7 @@ static void v4l_print_format(const void *arg, bool write_only)
const struct v4l2_window *win; const struct v4l2_window *win;
const struct v4l2_sdr_format *sdr; const struct v4l2_sdr_format *sdr;
const struct v4l2_meta_format *meta; const struct v4l2_meta_format *meta;
u32 planes;
unsigned i; unsigned i;
pr_cont("type=%s", prt_names(p->type, v4l2_type_names)); pr_cont("type=%s", prt_names(p->type, v4l2_type_names));
...@@ -317,7 +318,8 @@ static void v4l_print_format(const void *arg, bool write_only) ...@@ -317,7 +318,8 @@ static void v4l_print_format(const void *arg, bool write_only)
prt_names(mp->field, v4l2_field_names), prt_names(mp->field, v4l2_field_names),
mp->colorspace, mp->num_planes, mp->flags, mp->colorspace, mp->num_planes, mp->flags,
mp->ycbcr_enc, mp->quantization, mp->xfer_func); mp->ycbcr_enc, mp->quantization, mp->xfer_func);
for (i = 0; i < mp->num_planes; i++) planes = min_t(u32, mp->num_planes, VIDEO_MAX_PLANES);
for (i = 0; i < planes; i++)
printk(KERN_DEBUG "plane %u: bytesperline=%u sizeimage=%u\n", i, printk(KERN_DEBUG "plane %u: bytesperline=%u sizeimage=%u\n", i,
mp->plane_fmt[i].bytesperline, mp->plane_fmt[i].bytesperline,
mp->plane_fmt[i].sizeimage); mp->plane_fmt[i].sizeimage);
...@@ -1551,8 +1553,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, ...@@ -1551,8 +1553,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
if (unlikely(!ops->vidioc_s_fmt_vid_cap_mplane)) if (unlikely(!ops->vidioc_s_fmt_vid_cap_mplane))
break; break;
CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES)
break;
for (i = 0; i < p->fmt.pix_mp.num_planes; i++) for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
bytesperline);
return ops->vidioc_s_fmt_vid_cap_mplane(file, fh, arg); return ops->vidioc_s_fmt_vid_cap_mplane(file, fh, arg);
case V4L2_BUF_TYPE_VIDEO_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (unlikely(!ops->vidioc_s_fmt_vid_overlay)) if (unlikely(!ops->vidioc_s_fmt_vid_overlay))
...@@ -1581,8 +1586,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, ...@@ -1581,8 +1586,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
if (unlikely(!ops->vidioc_s_fmt_vid_out_mplane)) if (unlikely(!ops->vidioc_s_fmt_vid_out_mplane))
break; break;
CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES)
break;
for (i = 0; i < p->fmt.pix_mp.num_planes; i++) for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
bytesperline);
return ops->vidioc_s_fmt_vid_out_mplane(file, fh, arg); return ops->vidioc_s_fmt_vid_out_mplane(file, fh, arg);
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (unlikely(!ops->vidioc_s_fmt_vid_out_overlay)) if (unlikely(!ops->vidioc_s_fmt_vid_out_overlay))
...@@ -1648,8 +1656,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, ...@@ -1648,8 +1656,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
if (unlikely(!ops->vidioc_try_fmt_vid_cap_mplane)) if (unlikely(!ops->vidioc_try_fmt_vid_cap_mplane))
break; break;
CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES)
break;
for (i = 0; i < p->fmt.pix_mp.num_planes; i++) for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
bytesperline);
return ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg); return ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg);
case V4L2_BUF_TYPE_VIDEO_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (unlikely(!ops->vidioc_try_fmt_vid_overlay)) if (unlikely(!ops->vidioc_try_fmt_vid_overlay))
...@@ -1678,8 +1689,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, ...@@ -1678,8 +1689,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
if (unlikely(!ops->vidioc_try_fmt_vid_out_mplane)) if (unlikely(!ops->vidioc_try_fmt_vid_out_mplane))
break; break;
CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES)
break;
for (i = 0; i < p->fmt.pix_mp.num_planes; i++) for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
bytesperline);
return ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg); return ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg);
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (unlikely(!ops->vidioc_try_fmt_vid_out_overlay)) if (unlikely(!ops->vidioc_try_fmt_vid_out_overlay))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment