#
583bea09 |
| 29-Apr-2024 |
Mauro Carvalho Chehab <mchehab@kernel.org> |
media: dw2102: fix a potential buffer overflow
commit 1c73d0b29d04bf4082e7beb6a508895e118ee30d upstream.
As pointed by smatch: drivers/media/usb/dvb-usb/dw2102.c:802 su3000_i2c_transfer() error:
media: dw2102: fix a potential buffer overflow
commit 1c73d0b29d04bf4082e7beb6a508895e118ee30d upstream.
As pointed by smatch: drivers/media/usb/dvb-usb/dw2102.c:802 su3000_i2c_transfer() error: __builtin_memcpy() '&state->data[4]' too small (64 vs 67)
That seemss to be due to a wrong copy-and-paste.
Fixes: 0e148a522b84 ("media: dw2102: Don't translate i2c read into write")
Reported-by: Hans Verkuil <hverkuil@xs4all.nl> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
af19067b |
| 16-Jan-2022 |
Michael Bunk <micha@freedict.org> |
media: dw2102: Don't translate i2c read into write
[ Upstream commit 0e148a522b8453115038193e19ec7bea71403e4a ]
The code ignored the I2C_M_RD flag on I2C messages. Instead it assumed an i2c transa
media: dw2102: Don't translate i2c read into write
[ Upstream commit 0e148a522b8453115038193e19ec7bea71403e4a ]
The code ignored the I2C_M_RD flag on I2C messages. Instead it assumed an i2c transaction with a single message must be a write operation and a transaction with two messages would be a read operation.
Though this works for the driver code, it leads to problems once the i2c device is exposed to code not knowing this convention. For example, I did "insmod i2c-dev" and issued read requests from userspace, which were translated into write requests and destroyed the EEPROM of my device.
So, just check and respect the I2C_M_READ flag, which indicates a read when set on a message. If it is absent, it is a write message.
Incidentally, changing from the case statement to a while loop allows the code to lift the limitation to two i2c messages per transaction.
There are 4 more *_i2c_transfer functions affected by the same behaviour and limitation that should be fixed in the same way.
Link: https://lore.kernel.org/linux-media/20220116112238.74171-2-micha@freedict.org Signed-off-by: Michael Bunk <micha@freedict.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
#
5ae544d9 |
| 08-Jul-2023 |
Zhang Shurong <zhang_shurong@foxmail.com> |
media: dw2102: Fix null-ptr-deref in dw2102_i2c_transfer()
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 pas
media: dw2102: Fix null-ptr-deref in dw2102_i2c_transfer()
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>
show more ...
|
#
b37d9c99 |
| 13-May-2023 |
Mauro Carvalho Chehab <mchehab@kernel.org> |
media: dw2102: return -EIO instead of -1 for mac address read errors
The dvb-usb core function only checks if the returned value is zero, so it doesn't actually matter the error code. Still, returni
media: dw2102: return -EIO instead of -1 for mac address read errors
The dvb-usb core function only checks if the returned value is zero, so it doesn't actually matter the error code. Still, returning -1 as an error condition is something that we don't do upstream. So, change the logic to return -EIO in case of I2C transfer failures.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
#
663e7460 |
| 20-Mar-2023 |
Yu Zhe <yuzhe@nfschina.com> |
media: dvb-usb: remove unnecessary (void*) conversions
Pointer variables of void * type do not require type cast.
Link: https://lore.kernel.org/linux-media/20230320064039.5670-1-yuzhe@nfschina.com
media: dvb-usb: remove unnecessary (void*) conversions
Pointer variables of void * type do not require type cast.
Link: https://lore.kernel.org/linux-media/20230320064039.5670-1-yuzhe@nfschina.com Signed-off-by: Yu Zhe <yuzhe@nfschina.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
#
a3fd1ef2 |
| 28-Mar-2023 |
Wei Chen <harperchen1110@gmail.com> |
media: dvb-usb: dw2102: fix uninit-value in su3000_read_mac_address
In su3000_read_mac_address, if i2c_transfer fails to execute two messages, array mac address will not be initialized. Without hand
media: dvb-usb: dw2102: fix uninit-value in su3000_read_mac_address
In su3000_read_mac_address, if i2c_transfer fails to execute two messages, array mac address will not be initialized. Without handling such error, later in function dvb_usb_adapter_dvb_init, proposed_mac is accessed before initialization.
Fix this error by returning a negative value if message execution fails.
Link: https://lore.kernel.org/linux-media/20230328124416.560889-1-harperchen1110@gmail.com Signed-off-by: Wei Chen <harperchen1110@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
#
2fa2002f |
| 28-Mar-2022 |
Mauro Carvalho Chehab <mchehab@kernel.org> |
media: dw2102: use the newer dvb-usb macros for USB device
In order to make the drivers under dvb-usb more homogeneous, use the new macro, and rename some PIDs.
Link: https://lore.kernel.org/linux-
media: dw2102: use the newer dvb-usb macros for USB device
In order to make the drivers under dvb-usb more homogeneous, use the new macro, and rename some PIDs.
Link: https://lore.kernel.org/linux-media/828998ef3f0843bab4e84780e42f8f0802f57be7.1648499509.git.mchehab@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
#
2f8bc51d |
| 28-Mar-2022 |
Mauro Carvalho Chehab <mchehab@kernel.org> |
media: dvb-usb: move USB IDs to dvb-usb-ids.h
Almost all drivers based on dvb-usb place their USB IDs at dvb-usb-ids.h. In order to make it more standard, place the remaining ones also there.
Link:
media: dvb-usb: move USB IDs to dvb-usb-ids.h
Almost all drivers based on dvb-usb place their USB IDs at dvb-usb-ids.h. In order to make it more standard, place the remaining ones also there.
Link: https://lore.kernel.org/linux-media/7b32d5383169d23082758a7b69edef2f099202f3.1648499509.git.mchehab@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
#
589a9f0e |
| 22-Aug-2019 |
Anton Vasilyev <vasilyev@ispras.ru> |
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 fre
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>
show more ...
|
#
9cd4bcfb |
| 06-Oct-2020 |
Kai Muenz <squ@tent.at> |
media: dvb-usb: Add Hauppauge MAX S2's USB-IDs
Hauppauge MAX S2 or WinTV NOVA HD USB2.0.
Signed-off-by: Kai Muenz <squ@tent.at> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carval
media: dvb-usb: Add Hauppauge MAX S2's USB-IDs
Hauppauge MAX S2 or WinTV NOVA HD USB2.0.
Signed-off-by: Kai Muenz <squ@tent.at> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
#
df561f66 |
| 23-Aug-2020 |
Gustavo A. R. Silva <gustavoars@kernel.org> |
treewide: Use fallthrough pseudo-keyword
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through mar
treewide: Use fallthrough pseudo-keyword
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case.
[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
show more ...
|
#
528b1a1a |
| 11-May-2020 |
Dirk Nehring <dnehring@gmx.net> |
media: dvb-usb: Add Cinergy S2 PCIe Dual Port support
Terratec Cinergy S2 PCIe Dual is a PCIe device with two tuners that actually contains two USB devices. The devices are visible in the lsusb prin
media: dvb-usb: Add Cinergy S2 PCIe Dual Port support
Terratec Cinergy S2 PCIe Dual is a PCIe device with two tuners that actually contains two USB devices. The devices are visible in the lsusb printout.
Bus 004 Device 002: ID 153b:1182 TerraTec Electronic GmbH Cinergy S2 PCIe Dual Port 2 Bus 003 Device 002: ID 153b:1181 TerraTec Electronic GmbH Cinergy S2 PCIe Dual Port 1
The devices use the Montage M88DS3000/M88TS2022 demod/tuner.
Signed-off-by: Dirk Nehring <dnehring@gmx.net> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
#
d27958df |
| 14-Apr-2020 |
Sean Young <sean@mess.org> |
media: dvb-usb: make dvb_usb_device_properties const
This makes it possible to declare dvb_usb_device_properties const.
Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Cheha
media: dvb-usb: make dvb_usb_device_properties const
This makes it possible to declare dvb_usb_device_properties const.
Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
#
577a7ad3 |
| 04-Mar-2020 |
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
media: docs: move driver-specific info to driver-api
Those documents don't really describe the driver API.
Instead, they contain development-specific information.
Yet, as the main index file descr
media: docs: move driver-specific info to driver-api
Those documents don't really describe the driver API.
Instead, they contain development-specific information.
Yet, as the main index file describes the content of it as:
"how specific kernel subsystems work from the point of view of a kernel developer"
It seems to be the better fit.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
#
889968a4 |
| 01-Feb-2020 |
Brad Love <brad@nextdimension.cc> |
media: dw2102: probe for demodulator i2c address
This is required to support the Terratec S2 USB Box Revision 4, which reused usb vid:pid, but has a different demodulator (m88ds3103b) at i2c address
media: dw2102: probe for demodulator i2c address
This is required to support the Terratec S2 USB Box Revision 4, which reused usb vid:pid, but has a different demodulator (m88ds3103b) at i2c address 0x6a.
[fixed checkpatch issues]
Signed-off-by: Michael Bunk <micha@freedict.org> Signed-off-by: Brad Love <brad@nextdimension.cc> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
#
334f6aaf |
| 16-Dec-2019 |
Wolfram Sang <wsa+renesas@sang-engineering.com> |
media: usb: dvb-usb: dw2102: convert to use i2c_new_client_device()
Use the newer API returning an ERRPTR and use the new helper to bail out.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineeri
media: usb: dvb-usb: dw2102: convert to use i2c_new_client_device()
Use the newer API returning an ERRPTR and use the new helper to bail out.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
show more ...
|
#
a10e763b |
| 31-May-2019 |
Thomas Gleixner <tglx@linutronix.de> |
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372
Based on 1 normalized pattern(s):
this program is free software you can redistribute it and or modify it under the terms of th
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372
Based on 1 normalized pattern(s):
this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation version 2
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-only
has been chosen to replace the boilerplate/reference in 135 file(s).
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190531081036.435762997@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
c0decac1 |
| 10-Sep-2018 |
Mauro Carvalho Chehab <mchehab+samsung@kernel.org> |
media: use strscpy() instead of strlcpy()
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.
Signed-off-by: Mauro Carvalho Che
media: use strscpy() instead of strlcpy()
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
show more ...
|
#
299c7007 |
| 23-Jul-2018 |
Anton Vasilyev <vasilyev@ispras.ru> |
media: dw2102: Fix memleak on sequence of probes
Each call to dw2102_probe() allocates memory by kmemdup for structures p1100, s660, p7500 and s421, but there is no their deallocation. dvb_usb_devic
media: dw2102: Fix memleak on sequence of probes
Each call to dw2102_probe() allocates memory by kmemdup for structures p1100, s660, p7500 and s421, but there is no their deallocation. dvb_usb_device_init() copies the corresponding structure into dvb_usb_device->props, so there is no use of original structure after dvb_usb_device_init().
The patch moves structures from global scope to local and adds their deallocation.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
show more ...
|
#
670d7adb |
| 08-May-2018 |
Mauro Carvalho Chehab <mchehab+samsung@kernel.org> |
media: dvb: point to the location of the old README.dvb-usb file
This file got renamed, but the references still point to the old place.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel
media: dvb: point to the location of the old README.dvb-usb file
This file got renamed, but the references still point to the old place.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Jonathan Corbet <corbet@lwn.net>
show more ...
|
#
fe63a1a6 |
| 08-May-2018 |
Mauro Carvalho Chehab <mchehab+samsung@kernel.org> |
media: dvb: fix location of get_dvb_firmware script
This script was moved out of Documentation/dvb, but the links weren't updated.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
media: dvb: fix location of get_dvb_firmware script
This script was moved out of Documentation/dvb, but the links weren't updated.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Jonathan Corbet <corbet@lwn.net>
show more ...
|
#
fada1935 |
| 28-Dec-2017 |
Mauro Carvalho Chehab <mchehab@s-opensource.com> |
media: move dvb kAPI headers to include/media
Except for DVB, all media kAPI headers are at include/media.
Move the headers to it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
|
#
651ac129 |
| 03-Aug-2017 |
Bhumika Goyal <bhumirks@gmail.com> |
media: dw2102: make dvb_usb_device_description structures const
dvb_usb_device_description structures are only used during a copy operation. Therefore, declare them as const.
Signed-off-by: Bhumika
media: dw2102: make dvb_usb_device_description structures const
dvb_usb_device_description structures are only used during a copy operation. Therefore, declare them as const.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
show more ...
|
#
be90cc8e |
| 10-Aug-2017 |
Anton Vasilyev <vasilyev@ispras.ru> |
media: dvb-usb: Add memory free on error path in dw2102_probe()
If dw2102_probe() fails on dvb_usb_device_init(), then memleak occurs.
The patch adds deallocation to the error path.
Found by Linux
media: dvb-usb: Add memory free on error path in dw2102_probe()
If dw2102_probe() fails on dvb_usb_device_init(), then memleak occurs.
The patch adds deallocation to the error path.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru> Reviewed-by: Enrico Mioso <mrkiko.rs@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
show more ...
|
#
6d741bfe |
| 07-Aug-2017 |
Sean Young <sean@mess.org> |
media: rc: rename RC_TYPE_* to RC_PROTO_* and RC_BIT_* to RC_PROTO_BIT_*
RC_TYPE is confusing and it's just the protocol. So rename it.
Suggested-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-of
media: rc: rename RC_TYPE_* to RC_PROTO_* and RC_BIT_* to RC_PROTO_BIT_*
RC_TYPE is confusing and it's just the protocol. So rename it.
Suggested-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Sean Young <sean@mess.org> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
show more ...
|