[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250620212222.3204215-1-alexguo1023@gmail.com>
Date: Fri, 20 Jun 2025 17:22:22 -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: dvb-usb: dw2102: fix null-ptr-deref in dw3101_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 | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
index 7c9d09d49da4..8f694d8d52bc 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -562,7 +562,10 @@ static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
}
case(DW2102_RC_QUERY): {
u8 ibuf[2];
-
+ if (msg[0].len < 2) {
+ ret = -EOPNOTSUPP;
+ goto unlock;
+ }
dw210x_op_rw(d->udev, 0xb8, 0, 0,
ibuf, 2, DW210X_READ_MSG);
memcpy(msg[0].buf, ibuf, 2);
--
2.34.1
Powered by blists - more mailing lists