[media] v4l: Validate fields in the core code for subdev EDID ioctls
The subdev EDID ioctls receive a pad field that must reference an existing pad and an EDID field that must point to a buffer. Validate both fields in the core code instead of duplicating validation in all drivers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
9cfd65e809
commit
f2e9084779
5 changed files with 20 additions and 16 deletions
|
@ -361,11 +361,27 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
|
|||
sd, pad, set_selection, subdev_fh, sel);
|
||||
}
|
||||
|
||||
case VIDIOC_G_EDID:
|
||||
return v4l2_subdev_call(sd, pad, get_edid, arg);
|
||||
case VIDIOC_G_EDID: {
|
||||
struct v4l2_subdev_edid *edid = arg;
|
||||
|
||||
case VIDIOC_S_EDID:
|
||||
return v4l2_subdev_call(sd, pad, set_edid, arg);
|
||||
if (edid->pad >= sd->entity.num_pads)
|
||||
return -EINVAL;
|
||||
if (edid->blocks && edid->edid == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
return v4l2_subdev_call(sd, pad, get_edid, edid);
|
||||
}
|
||||
|
||||
case VIDIOC_S_EDID: {
|
||||
struct v4l2_subdev_edid *edid = arg;
|
||||
|
||||
if (edid->pad >= sd->entity.num_pads)
|
||||
return -EINVAL;
|
||||
if (edid->blocks && edid->edid == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
return v4l2_subdev_call(sd, pad, set_edid, edid);
|
||||
}
|
||||
|
||||
case VIDIOC_SUBDEV_DV_TIMINGS_CAP: {
|
||||
struct v4l2_dv_timings_cap *cap = arg;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue