media fixes for v5.0-rc3

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJcQgyKAAoJEAhfPr2O5OEVmIkQAI4myAIoAeZKtSp/LKIPOUaX
 YBh9UGaXw+BGFTjbTn5/QbT5OpjpX6uquEkpelPEWdk9h6iVGUNLPnZ+2rQYR2rX
 J8hUPGyFFge7D3FWAlRSD0th0ff2rB+/7PBhJ87F+pAEfR8FgUZWkeZd2G2Msx/1
 eh2QG4VqPK0Jy9ZjfMvbxu+QVEAEeVhQ2EdMW5gcttpJYDElztZ5YlJGGENuzULo
 gI64bXnaBYFBCPd+SvhuxCapcI2EldYVYVG+OnYXJw3iwVo/XWRywmepqsXv5Kgn
 ZWzLqfmCUQogfdNotkXOiNfiSGMYHoZGTfSzsTUzz87hfOVVbF7d8l0Q1WNfs9IF
 wiehtj/DGocDKMiAE6Ol+duL0nvwhdSi8jFL7a3ydRUeJENCatVjK6pP6cujo4tS
 HUYeP7glD+Xwib6N9XzqC7axWQc2Dst137+r50SDNZXLcYmm83HU9uhj4wLG9JNp
 2fXlJqfJvILf+M8KuA2wfXXCXQJKnAEcA3+D/VeNjcWGAoaXGORJXWwP8P6ZGaGe
 XTfhKItW1N7GaQWNhmcFuDmoG1WM3Ym0XDDhkmSdc18R29w4X7+bJkA8kyNIcMft
 VedcKEGACeqyZWNxUPKoNcFU19PtcQ91L2tSXytlmQfwX3C9WF0AJaI/oxWCw2O/
 LLaJBj5vJuL4wtkPwnEj
 =qasf
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2019-01-19 07:34:10 +12:00
commit 2339e91d0e
2 changed files with 22 additions and 6 deletions

View file

@ -807,7 +807,9 @@ static void vim2m_stop_streaming(struct vb2_queue *q)
struct vb2_v4l2_buffer *vbuf;
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 (;;) {
if (V4L2_TYPE_IS_OUTPUT(q->type))
vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);

View file

@ -287,6 +287,7 @@ static void v4l_print_format(const void *arg, bool write_only)
const struct v4l2_window *win;
const struct v4l2_sdr_format *sdr;
const struct v4l2_meta_format *meta;
u32 planes;
unsigned i;
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)
prt_names(mp->field, v4l2_field_names),
mp->colorspace, mp->num_planes, mp->flags,
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,
mp->plane_fmt[i].bytesperline,
mp->plane_fmt[i].sizeimage);
@ -1551,8 +1553,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
if (unlikely(!ops->vidioc_s_fmt_vid_cap_mplane))
break;
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++)
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);
case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (unlikely(!ops->vidioc_s_fmt_vid_overlay))
@ -1581,8 +1586,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
if (unlikely(!ops->vidioc_s_fmt_vid_out_mplane))
break;
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++)
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);
case V4L2_BUF_TYPE_VIDEO_OUTPUT_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,
if (unlikely(!ops->vidioc_try_fmt_vid_cap_mplane))
break;
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++)
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);
case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (unlikely(!ops->vidioc_try_fmt_vid_overlay))
@ -1678,8 +1689,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
if (unlikely(!ops->vidioc_try_fmt_vid_out_mplane))
break;
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++)
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);
case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
if (unlikely(!ops->vidioc_try_fmt_vid_out_overlay))