linux/drivers/media
Michael Kuron f7b77ebe6d media: dib0700: fix undefined behavior in tuner shutdown
This fixes a problem where closing the tuner would leave it in a state
where it would not tune to any channel when reopened. This problem was
discovered as part of https://github.com/hselasky/webcamd/issues/16.

Since adap->id is 0 or 1, this bit-shift overflows, which is undefined
behavior. The driver still worked in practice as the overflow would in
most environments result in 0, which rendered the line a no-op. When
running the driver as part of webcamd however, the overflow could lead
to 0xff due to optimizations by the compiler, which would, in the end,
improperly shut down the tuner.

The bug is a regression introduced in the commit referenced below. The
present patch causes identical behavior to before that commit for
adap->id equal to 0 or 1. The driver does not contain support for
dib0700 devices with more adapters, assuming such even exist.

Tests have been performed with the Xbox One Digital TV Tuner on amd64.
Not all dib0700 devices are expected to be affected by the regression;
this code path is only taken by those with incorrect endpoint numbers.

Link: https://lore.kernel.org/linux-media/1d2fc36d94ced6f67c7cc21dcc469d5e5bdd8201.1632689033.git.mchehab+huawei@kernel.org

Cc: stable@vger.kernel.org
Fixes: 7757ddda6f ("[media] DiB0700: add function to change I2C-speed")
Signed-off-by: Michael Kuron <michael.kuron@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-19 16:22:42 +00:00
..
cec media: CEC: keep related menu entries together 2021-10-05 09:39:32 +02:00
common media: videobuf2: Fix the size printk format 2021-11-15 08:11:31 +00:00
dvb-core media: media dvb_frontend: add suspend and resume callbacks to dvb_frontend_ops 2021-11-19 15:57:22 +00:00
dvb-frontends media: s5h1411.c: Fix a typo in the VSB SNR table 2021-11-19 16:19:59 +00:00
firewire media: firewire: firedtv-avc: fix a buffer overflow in avc_ca_pmt() 2021-09-30 10:07:54 +02:00
i2c media: dw9768: activate runtime PM and turn off device 2021-11-15 08:11:34 +00:00
mc media: Request API is no longer experimental 2021-09-30 10:07:55 +02:00
mmc media updates for v5.8-rc1 2020-06-03 20:59:38 -07:00
pci media: b2c2: Add missing check in flexcop_pci_isr: 2021-11-19 15:40:09 +00:00
platform media: coda: V4L2_PIX_FMT_GREY for coda960 JPEG Encoder 2021-11-19 06:10:06 +00:00
radio media: si470x: Avoid card name truncation 2021-09-30 10:08:00 +02:00
rc media: redrat3: fix control-message timeouts 2021-11-19 06:04:16 +00:00
spi media: cxd2880-spi: Fix a null pointer dereference on error handling path 2021-09-30 10:07:40 +02:00
test-drivers media: vidtv: move kfree(dvb) to vidtv_bridge_dev_release() 2021-10-19 08:08:19 +01:00
tuners Linux 5.15-rc4 2021-10-04 07:52:13 +02:00
usb media: dib0700: fix undefined behavior in tuner shutdown 2021-11-19 16:22:42 +00:00
v4l2-core media: v4l2-ioctl.c: readbuffers depends on V4L2_CAP_READWRITE 2021-11-15 08:12:04 +00:00
Kconfig media: correct MEDIA_TEST_SUPPORT help text 2021-11-15 08:12:06 +00:00
Makefile