]> git.baikalelectronics.ru Git - kernel.git/commit
media: dw2102: Fix null-ptr-deref in dw2102_i2c_transfer()
authorZhang Shurong <zhang_shurong@foxmail.com>
Sat, 8 Jul 2023 10:22:52 +0000 (18:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Sep 2023 09:11:06 +0000 (11:11 +0200)
commit08dfcbd03b2b7f918c4f87c6ff637054e510df74
treee015f45daeb183a2368ea72f5e3d5262213702b8
parent0143f282b15f7cedc0392ea10050fb6000fd16e6
media: dw2102: Fix null-ptr-deref in dw2102_i2c_transfer()

[ Upstream commit 5ae544d94abc8ff77b1b9bf8774def3fa5689b5b ]

In dw2102_i2c_transfer, msg is controlled by user. When msg[i].buf
is null and msg[i].len is zero, former checks on msg[i].buf would be
passed. Malicious data finally reach dw2102_i2c_transfer. If accessing
msg[i].buf[0] without sanity check, null ptr deref would happen.
We add check on msg[i].len to prevent crash.

Similar commit:
commit 950e252cb469
("[media] dw2102: limit messages to buffer size")

Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/dvb-usb/dw2102.c