Skip to content

Commit

Permalink
[media] v4l2-compat-ioctl32: VIDIOC_S_EDID should return all fields o…
Browse files Browse the repository at this point in the history
…n error

Most ioctls do not have to write back the contents of the argument
if an error is returned. But VIDIOC_S_EDID is an exception together
with the EXT_CTRLS ioctls (already handled correctly).

Add this exception to v4l2-compat-ioctl32.

This fixes a compliance error when using compat32 and trying to
set a new EDID with more blocks than the hardware supports. In
that case the driver will return -E2BIG and set edid.blocks to the
actual maximum number of blocks. This field was never copied back
to userspace due to this bug.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
  • Loading branch information
hverkuil authored and mchehab committed Apr 10, 2017
1 parent 3369cde commit ba7ed69
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/media/v4l2-core/v4l2-compat-ioctl32.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,10 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar
if (put_v4l2_ext_controls32(&karg.v2ecs, up))
err = -EFAULT;
break;
case VIDIOC_S_EDID:
if (put_v4l2_edid32(&karg.v2edid, up))
err = -EFAULT;
break;
}
if (err)
return err;
Expand All @@ -1011,7 +1015,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar
break;

case VIDIOC_G_EDID:
case VIDIOC_S_EDID:
err = put_v4l2_edid32(&karg.v2edid, up);
break;

Expand Down

0 comments on commit ba7ed69

Please sign in to comment.