]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
media: af9035: prevent buffer overflow on write
authorJozef Balga <jozef.balga@gmail.com>
Tue, 21 Aug 2018 09:01:04 +0000 (05:01 -0400)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:54:14 +0000 (19:54 -0600)
commitf05c39fc2c9a9eab10229bf1996f5f373077f080
tree25e5c27711b1563eb8aeaf44b8efdf86d80a0423
parent39ed32a89625ab86f9c40b6b04e48252cc741d97
media: af9035: prevent buffer overflow on write

BugLink: https://bugs.launchpad.net/bugs/1836654
[ Upstream commit 312f73b648626a0526a3aceebb0a3192aaba05ce ]

When less than 3 bytes are written to the device, memcpy is called with
negative array size which leads to buffer overflow and kernel panic. This
patch adds a condition and returns -EOPNOTSUPP instead.
Fixes bugzilla issue 64871

[mchehab+samsung@kernel.org: fix a merge conflict and changed the
 condition to match the patch's comment, e. g. len == 3 could
 also be valid]
Signed-off-by: Jozef Balga <jozef.balga@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/media/usb/dvb-usb-v2/af9035.c