diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2011-01-08 09:53:32 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-01-19 11:45:13 -0200 |
commit | a1198ccf9c52922e66a3372b0045ebe335a127dd (patch) | |
tree | 246bd2f8cbba0b71bf63cc2c07495e7172685dda /drivers/media/video | |
parent | 4c775902252b06673cf26a33834842f1fec3fe3e (diff) | |
download | kernel_samsung_tuna-a1198ccf9c52922e66a3372b0045ebe335a127dd.zip kernel_samsung_tuna-a1198ccf9c52922e66a3372b0045ebe335a127dd.tar.gz kernel_samsung_tuna-a1198ccf9c52922e66a3372b0045ebe335a127dd.tar.bz2 |
[media] v4l2-ioctl: fix incorrect error code if VIDIOC_DBG_G/S_REGISTER are unsupported
The ioctls VIDIOC_DBG_S_REGISTER and VIDIOC_DBG_G_REGISTER should return -EINVAL
if the driver didn't implement them. Currently they return -EPERM if called as
non-root user. However, this check should only be done if the driver actually
implemented these ioctls. Otherwise, just return -EINVAL as we do with all
unimplemented ioctls.
This bug make the v4l2-compliance test suite fail.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/v4l2-ioctl.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 7e47f15..f51327e 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -1659,20 +1659,24 @@ static long __video_do_ioctl(struct file *file, { struct v4l2_dbg_register *p = arg; - if (!capable(CAP_SYS_ADMIN)) - ret = -EPERM; - else if (ops->vidioc_g_register) - ret = ops->vidioc_g_register(file, fh, p); + if (ops->vidioc_g_register) { + if (!capable(CAP_SYS_ADMIN)) + ret = -EPERM; + else + ret = ops->vidioc_g_register(file, fh, p); + } break; } case VIDIOC_DBG_S_REGISTER: { struct v4l2_dbg_register *p = arg; - if (!capable(CAP_SYS_ADMIN)) - ret = -EPERM; - else if (ops->vidioc_s_register) - ret = ops->vidioc_s_register(file, fh, p); + if (ops->vidioc_s_register) { + if (!capable(CAP_SYS_ADMIN)) + ret = -EPERM; + else + ret = ops->vidioc_s_register(file, fh, p); + } break; } #endif |