]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
media: cx25821: prevent out-of-bounds read on array card
authorColin Ian King <colin.king@canonical.com>
Wed, 31 Jan 2018 17:33:09 +0000 (12:33 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 Aug 2018 10:29:44 +0000 (12:29 +0200)
commitcf284b68220b6e65b247788984d77808647d1511
tree5654b9d657878ae3d6976a144707235c02d594f2
parentfc1110b727f101a41b3fdb8a3a1c8053469dd211
media: cx25821: prevent out-of-bounds read on array card

BugLink: http://bugs.launchpad.net/bugs/1783418
[ Upstream commit 67300abdbe9f1717532aaf4e037222762716d0f6 ]

Currently an out of range dev->nr is detected by just reporting the
issue and later on an out-of-bounds read on array card occurs because
of this. Fix this by checking the upper range of dev->nr with the size
of array card (removes the hard coded size), move this check earlier
and also exit with the error -ENOSYS to avoid the later out-of-bounds
array read.

Detected by CoverityScan, CID#711191 ("Out-of-bounds-read")

Fixes: commit 02b20b0b4cde ("V4L/DVB (12730): Add conexant cx25821 driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: %ld -> %zd]
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/media/pci/cx25821/cx25821-core.c