media: dw2102: Fix use after free
authorAnton Vasilyev <vasilyev@ispras.ru>
Thu, 22 Aug 2019 10:41:47 +0000 (12:41 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 14 Dec 2021 14:09:14 +0000 (15:09 +0100)
commit589a9f0eb799f77de2c09583bf5bad221fa5d685
tree64d5eb54410a07a52c39064a0f78078b38b86d54
parentc00d65e6df8dfe98a595c79eb6ed0ea1067ba565
media: dw2102: Fix use after free

dvb_usb_device_init stores parts of properties at d->props
and d->desc and uses it on dvb_usb_device_exit.
Free of properties on module probe leads to use after free.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204597

The patch makes properties static instead of allocated on heap to prevent
memleak and use after free.
Also fixes s421_properties.devices initialization to have 2 element
instead of 6 copied from p7500_properties.

[mchehab: fix function call alignments]
Link: https://lore.kernel.org/linux-media/20190822104147.4420-1-vasilyev@ispras.ru
Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Fixes: 299c7007e936 ("media: dw2102: Fix memleak on sequence of probes")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/usb/dvb-usb/dw2102.c