]> git.baikalelectronics.ru Git - 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)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 29 Aug 2018 17:54:37 +0000 (13:54 -0400)
commit6684ba296e9bdd06466b272077b3ad7f4530eed8
tree6b295d08d00ac14979d382868e6d25c8820eed55
parent370bebf1d4eeb754a23343331c74816cda4b2437
media: af9035: prevent buffer overflow on write

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>
drivers/media/usb/dvb-usb-v2/af9035.c