diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2009-03-28 18:25:35 -0700 |
---|---|---|
committer | Trent Piepho <xyzzy@speakeasy.org> | 2009-03-28 18:25:35 -0700 |
commit | c6a7ca4c96fd867b70c72a7fdb08866a592dd844 (patch) | |
tree | 00a9ef44e196a9d4b9ed3622bb7d793e8044d750 | |
parent | 99a1c4eefe8e5d8259545a9738c343719aaa65f4 (diff) | |
download | mediapointer-dvb-s2-c6a7ca4c96fd867b70c72a7fdb08866a592dd844.tar.gz mediapointer-dvb-s2-c6a7ca4c96fd867b70c72a7fdb08866a592dd844.tar.bz2 |
v4l2-ioctl: Check format for S_PARM and G_PARM
From: Trent Piepho <xyzzy@speakeasy.org>
Return EINVAL if VIDIOC_S/G_PARM is called for a buffer type that the
driver doesn't define a ->vidioc_try_fmt_XXX() method for. Several other
ioctls, like QUERYBUF, QBUF, and DQBUF, etc. do this too. It saves each
driver from having to check if the buffer type is one that it supports.
Priority: normal
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
-rw-r--r-- | linux/drivers/media/video/v4l2-ioctl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/linux/drivers/media/video/v4l2-ioctl.c b/linux/drivers/media/video/v4l2-ioctl.c index 5cf729c9d..c16ef96ee 100644 --- a/linux/drivers/media/video/v4l2-ioctl.c +++ b/linux/drivers/media/video/v4l2-ioctl.c @@ -1552,6 +1552,9 @@ static long __video_do_ioctl(struct file *file, struct v4l2_streamparm *p = arg; if (ops->vidioc_g_parm) { + ret = check_fmt(ops, p->type); + if (ret) + break; ret = ops->vidioc_g_parm(file, fh, p); } else { if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) @@ -1571,6 +1574,10 @@ static long __video_do_ioctl(struct file *file, if (!ops->vidioc_s_parm) break; + ret = check_fmt(ops, p->type); + if (ret) + break; + dbgarg(cmd, "type=%d\n", p->type); ret = ops->vidioc_s_parm(file, fh, p); break; |