android_kernel_samsung_msm8976/drivers/media/tuners
Takashi Iwai 29ae6dcd31 xc2028: Fix use-after-free bug properly
commit 22a1e7783e173ab3d86018eb590107d68df46c11 upstream.

The commit 8dfbcc4351a0 ("[media] xc2028: avoid use after free") tried
to address the reported use-after-free by clearing the reference.

However, it's clearing the wrong pointer; it sets NULL to
priv->ctrl.fname, but it's anyway overwritten by the next line
memcpy(&priv->ctrl, p, sizeof(priv->ctrl)).

OTOH, the actual code accessing the freed string is the strcmp() call
with priv->fname:
	if (!firmware_name[0] && p->fname &&
	    priv->fname && strcmp(p->fname, priv->fname))
		free_firmware(priv);

where priv->fname points to the previous file name, and this was
already freed by kfree().

For fixing the bug properly, this patch does the following:

- Keep the copy of firmware file name in only priv->fname,
  priv->ctrl.fname isn't changed;
- The allocation is done only when the firmware gets loaded;
- The kfree() is called in free_firmware() commonly

Fixes: commit 8dfbcc4351a0 ('[media] xc2028: avoid use after free')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
2019-07-27 21:43:23 +02:00
..
Kconfig [media] Fix build when drivers are builtin and frontend modules 2013-06-20 10:35:53 -03:00
Makefile [media] r820t: Add a tuner driver for Rafael Micro R820T silicon tuner 2013-04-16 21:18:42 -03:00
e4000.c media: tuners: Don't use dynamic static allocation 2013-12-04 10:57:32 -08:00
e4000.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
e4000_priv.h
fc001x-common.h
fc0011.c
fc0011.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
fc0012-priv.h
fc0012.c
fc0012.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
fc0013-priv.h
fc0013.c
fc0013.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
fc2580.c media: fc2580: fix tuning failure on 32-bit arch 2014-06-07 13:25:40 -07:00
fc2580.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
fc2580_priv.h media: fc2580: fix tuning failure on 32-bit arch 2014-06-07 13:25:40 -07:00
max2165.c
max2165.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
max2165_priv.h
mc44s803.c
mc44s803.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
mc44s803_priv.h
mt20xx.c
mt20xx.h
mt2060.c
mt2060.h
mt2060_priv.h
mt2063.c
mt2063.h
mt2131.c
mt2131.h
mt2131_priv.h
mt2266.c
mt2266.h
mxl5005s.c
mxl5005s.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
mxl5007t.c
mxl5007t.h
qt1010.c
qt1010.h
qt1010_priv.h
r820t.c [media] r820t: Remove a warning for an unused value 2013-04-25 16:07:04 -03:00
r820t.h [media] r820t: Remove a warning for an unused value 2013-04-25 16:07:04 -03:00
tda827x.c [media] tda8290: change magic LNA config values to enum 2013-04-08 07:05:15 -03:00
tda827x.h [media] tda8290: change magic LNA config values to enum 2013-04-08 07:05:15 -03:00
tda8290.c [media] tuner-core/simple: get_rf_strength can be tuner mode specific 2013-04-14 19:44:50 -03:00
tda8290.h [media] tda8290: change magic LNA config values to enum 2013-04-08 07:05:15 -03:00
tda9887.c [media] tuner-core/tda9887: get_afc can be tuner mode specific 2013-04-14 19:43:40 -03:00
tda9887.h
tda18212.c media: tuners: Don't use dynamic static allocation 2013-12-04 10:57:32 -08:00
tda18212.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
tda18218.c media: tuners: Don't use dynamic static allocation 2013-12-04 10:57:32 -08:00
tda18218.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
tda18218_priv.h
tda18271-common.c
tda18271-fe.c [media] tda8290: change magic LNA config values to enum 2013-04-08 07:05:15 -03:00
tda18271-maps.c
tda18271-priv.h
tda18271.h
tea5761.c
tea5761.h
tea5767.c
tea5767.h
tua9001.c
tua9001.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00
tua9001_priv.h
tuner-i2c.h
tuner-simple.c [media] tuner-core/simple: get_rf_strength can be tuner mode specific 2013-04-14 19:44:50 -03:00
tuner-simple.h
tuner-types.c [media] tuner: add Sony BTF tuners 2013-03-24 12:11:35 -03:00
tuner-xc2028-types.h
tuner-xc2028.c xc2028: Fix use-after-free bug properly 2019-07-27 21:43:23 +02:00
tuner-xc2028.h
tuner_it913x.c [media] it913x: rename its tuner driver to tuner_it913x 2013-04-16 20:06:05 -03:00
tuner_it913x.h [media] it913x: rename its tuner driver to tuner_it913x 2013-04-16 20:06:05 -03:00
tuner_it913x_priv.h [media] it913x: rename its tuner driver to tuner_it913x 2013-04-16 20:06:05 -03:00
xc4000.c media: xc4000: Fix get_frequency() 2014-09-17 09:03:57 -07:00
xc4000.h
xc5000.c media: xc5000: Fix get_frequency() 2014-09-17 09:03:56 -07:00
xc5000.h [media] tuners: use IS_ENABLED 2013-03-23 09:22:06 -03:00