linux-stable/drivers/media
Mauro Carvalho Chehab 686ee9b625 media: venus: don't de-reference NULL pointers at IRQ time
Smatch is warning that:
	drivers/media/platform/qcom/venus/hfi_venus.c:1100 venus_isr() warn: variable dereferenced before check 'hdev' (see line 1097)

The logic basically does:
	hdev = to_hfi_priv(core);

with is translated to:
	hdev = core->priv;

If the IRQ code can receive a NULL pointer for hdev, there's
a bug there, as it will first try to de-reference the pointer,
and then check if it is null.

After looking at the code, it seems that this indeed can happen:
Basically, the venus IRQ thread is started with:
	devm_request_threaded_irq()
So, it will only be freed after the driver unbinds.

In order to prevent the IRQ code to work with freed data,
the logic at venus_hfi_destroy() sets core->priv to NULL,
which would make the IRQ code to ignore any pending IRQs.

There is, however a race condition, as core->priv is set
to NULL only after being freed. So, we need also to move the
core->priv = NULL to happen earlier.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-04-08 10:04:20 +02:00
..
cec media: cec/core: clarify rx-arb-lost usage message 2021-04-06 16:08:38 +02:00
common media: media/siano: Fix transmission parameters reporting for ISDB-T 2021-03-23 08:29:37 +01:00
dvb-core media: dvbdev: Fix memory leak in dvb_media_device_free() 2021-03-22 23:36:39 +01:00
dvb-frontends media: dvb-frontends: lgdt3306a.c: remove dead code 2021-03-22 17:15:53 +01:00
firewire media: firewire: fix memory leak 2020-09-27 11:29:45 +02:00
i2c media: adv7511-v4l2: correctly report EDIDs of 1 block 2021-04-06 19:35:26 +02:00
mc media: entity: Add lockdep check to media graph walk 2021-04-06 14:35:14 +02:00
mmc
pci media: tw68: switch from 'pci_' to 'dma_' API 2021-04-06 16:07:42 +02:00
platform media: venus: don't de-reference NULL pointers at IRQ time 2021-04-08 10:04:20 +02:00
radio media: radio-si476x: rectify spelling and grammar 2021-03-22 11:58:42 +01:00
rc media: fix incorrect kernel doc usages 2021-03-11 11:59:44 +01:00
spi media: use getter/setter functions 2021-03-11 11:59:42 +01:00
test-drivers media: vivid: add read-only int32 control 2021-04-06 16:04:24 +02:00
tuners media: m88rs6000t: avoid potential out-of-bounds reads on arrays 2021-03-22 17:41:39 +01:00
usb media: em28xx/em28xx.h: Remove duplicate struct declaration 2021-04-06 16:11:54 +02:00
v4l2-core media: v4l2-ctrls.c: fix race condition in hdl->requests list 2021-04-06 16:05:33 +02:00
Kconfig media: Correct 'so' 2021-03-22 11:52:09 +01:00
Makefile