diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-05-29 07:00:00 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-17 08:53:48 -0300 |
commit | d2cac168160aa7afd472d4a04d0da3f146243710 (patch) | |
tree | e3cb6db23cc8060f882fd91d6b35ba355a909375 | |
parent | b83007024219c0135aa18ca5e756b3935c3b8e31 (diff) | |
download | linux-d2cac168160aa7afd472d4a04d0da3f146243710.tar.gz linux-d2cac168160aa7afd472d4a04d0da3f146243710.tar.bz2 linux-d2cac168160aa7afd472d4a04d0da3f146243710.zip |
[media] mxb: check register address when reading/writing a register
Prevent out-of-range register accesses.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/pci/saa7146/mxb.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c index 8d177691cd7c..33abe332d175 100644 --- a/drivers/media/pci/saa7146/mxb.c +++ b/drivers/media/pci/saa7146/mxb.c @@ -669,6 +669,8 @@ static int vidioc_g_register(struct file *file, void *fh, struct v4l2_dbg_regist { struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; + if (reg->reg > pci_resource_len(dev->pci, 0) - 4) + return -EINVAL; reg->val = saa7146_read(dev, reg->reg); reg->size = 4; return 0; @@ -678,6 +680,8 @@ static int vidioc_s_register(struct file *file, void *fh, const struct v4l2_dbg_ { struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; + if (reg->reg > pci_resource_len(dev->pci, 0) - 4) + return -EINVAL; saa7146_write(dev, reg->reg, reg->val); return 0; } |