diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-01-30 21:25:41 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-21 10:35:10 -0500 |
commit | 62d50addf0774115adaa9e01e09099c3d7daa13d (patch) | |
tree | 5490c0acef3aa645c6974437b3ca7a508ed755a3 /drivers/media/video/saa7115.c | |
parent | e7b58f5259a81dbd9fbfea79408d272f44eb894f (diff) |
V4L/DVB (5163): Add checks for CAP_SYS_ADMIN to VIDIOC_DBG_G_REGISTER
Before, root privileges were only needed to set hardware registers, not
to read them. On some hardware, reading from the wrong place at the
wrong time can hang the machine. So, to be consistent, root privileges
are required to read registers on all hardware.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7115.c')
-rw-r--r-- | drivers/media/video/saa7115.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index bb6aa135002..71777216b60 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1418,15 +1418,6 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1418 | 1418 | ||
1419 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1419 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1420 | case VIDIOC_DBG_G_REGISTER: | 1420 | case VIDIOC_DBG_G_REGISTER: |
1421 | { | ||
1422 | struct v4l2_register *reg = arg; | ||
1423 | |||
1424 | if (reg->i2c_id != I2C_DRIVERID_SAA711X) | ||
1425 | return -EINVAL; | ||
1426 | reg->val = saa711x_read(client, reg->reg & 0xff); | ||
1427 | break; | ||
1428 | } | ||
1429 | |||
1430 | case VIDIOC_DBG_S_REGISTER: | 1421 | case VIDIOC_DBG_S_REGISTER: |
1431 | { | 1422 | { |
1432 | struct v4l2_register *reg = arg; | 1423 | struct v4l2_register *reg = arg; |
@@ -1435,7 +1426,10 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1435 | return -EINVAL; | 1426 | return -EINVAL; |
1436 | if (!capable(CAP_SYS_ADMIN)) | 1427 | if (!capable(CAP_SYS_ADMIN)) |
1437 | return -EPERM; | 1428 | return -EPERM; |
1438 | saa711x_write(client, reg->reg & 0xff, reg->val & 0xff); | 1429 | if (cmd == VIDIOC_DBG_G_REGISTER) |
1430 | reg->val = saa711x_read(client, reg->reg & 0xff); | ||
1431 | else | ||
1432 | saa711x_write(client, reg->reg & 0xff, reg->val & 0xff); | ||
1439 | break; | 1433 | break; |
1440 | } | 1434 | } |
1441 | #endif | 1435 | #endif |