lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250620211919.3200929-1-alexguo1023@gmail.com>
Date: Fri, 20 Jun 2025 17:19:19 -0400
From: Alex Guo <alexguo1023@...il.com>
To: mchehab@...nel.org
Cc: alexguo1023@...il.com,
	hverkuil@...all.nl,
	linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] media: usb: dvb-usb: fix null-ptr-deref in dw2104_i2c_transfer

msg is controlled by user. If accessing msg.buf without sanity
check, null pointer deref would happen. We add check on
msg.len to prevent crash.

Similar commit: commit 0ed554fd769a ("media: dvb-usb: az6027:
fix null-ptr-deref in az6027_i2c_xfer()")

Signed-off-by: Alex Guo <alexguo1023@...il.com>
---
 drivers/media/usb/dvb-usb/dw2102.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
index 4fecf2f965e9..7c9d09d49da4 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -405,6 +405,8 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], i
 	for (j = 0; j < num; j++) {
 		switch (msg[j].addr) {
 		case(DW2102_RC_QUERY): {
+			if (msg[j].len < 2)
+				return -EOPNOTSUPP;
 			u8 ibuf[2];
 
 			dw210x_op_rw(d->udev, 0xb8, 0, 0,
@@ -413,6 +415,8 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], i
 			break;
 		}
 		case(DW2102_VOLTAGE_CTRL): {
+			if (msg[j].len < 1)
+				return -EOPNOTSUPP;
 			u8 obuf[2];
 
 			obuf[0] = 0x30;
@@ -427,6 +431,8 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], i
 		 * case 0x60: ts2020, stv6110, stb6100
 		 */
 		default: {
+			if (msg[j].len < 1)
+				return -EOPNOTSUPP;
 			if (msg[j].flags == I2C_M_RD) {
 				/* read registers */
 				u8  ibuf[MAX_XFER_SIZE];
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ