Commit 3ecc3791 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull media fix from Mauro Carvalho Chehab:
 "A v4l-core fix related to validating DV timings related to video
  blanking values"

* tag 'media/v6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  media: v4l2-dv-timings.c: fix too strict blanking sanity checks
parents 9857feb3 5eef2141
...@@ -145,6 +145,8 @@ bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *t, ...@@ -145,6 +145,8 @@ bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *t,
const struct v4l2_bt_timings *bt = &t->bt; const struct v4l2_bt_timings *bt = &t->bt;
const struct v4l2_bt_timings_cap *cap = &dvcap->bt; const struct v4l2_bt_timings_cap *cap = &dvcap->bt;
u32 caps = cap->capabilities; u32 caps = cap->capabilities;
const u32 max_vert = 10240;
u32 max_hor = 3 * bt->width;
if (t->type != V4L2_DV_BT_656_1120) if (t->type != V4L2_DV_BT_656_1120)
return false; return false;
...@@ -166,14 +168,20 @@ bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *t, ...@@ -166,14 +168,20 @@ bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *t,
if (!bt->interlaced && if (!bt->interlaced &&
(bt->il_vbackporch || bt->il_vsync || bt->il_vfrontporch)) (bt->il_vbackporch || bt->il_vsync || bt->il_vfrontporch))
return false; return false;
if (bt->hfrontporch > 2 * bt->width || /*
bt->hsync > 1024 || bt->hbackporch > 1024) * Some video receivers cannot properly separate the frontporch,
* backporch and sync values, and instead they only have the total
* blanking. That can be assigned to any of these three fields.
* So just check that none of these are way out of range.
*/
if (bt->hfrontporch > max_hor ||
bt->hsync > max_hor || bt->hbackporch > max_hor)
return false; return false;
if (bt->vfrontporch > 4096 || if (bt->vfrontporch > max_vert ||
bt->vsync > 128 || bt->vbackporch > 4096) bt->vsync > max_vert || bt->vbackporch > max_vert)
return false; return false;
if (bt->interlaced && (bt->il_vfrontporch > 4096 || if (bt->interlaced && (bt->il_vfrontporch > max_vert ||
bt->il_vsync > 128 || bt->il_vbackporch > 4096)) bt->il_vsync > max_vert || bt->il_vbackporch > max_vert))
return false; return false;
return fnc == NULL || fnc(t, fnc_handle); return fnc == NULL || fnc(t, fnc_handle);
} }
......
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