[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250421115045.81394-1-aha310510@gmail.com>
Date: Mon, 21 Apr 2025 20:50:45 +0900
From: Jeongjun Park <aha310510@...il.com>
To: mchehab@...nel.org
Cc: christophe.jaillet@...adoo.fr,
hverkuil@...all.nl,
harperchen1110@...il.com,
linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jeongjun Park <aha310510@...il.com>
Subject: [PATCH] media: dvb-usb: az6027: fix out-of-bounds in az6027_i2c_xfer()
Missing maximum size check on msg[i].len causes out-of-bounds vuln for u8 *data.
Therefore, we need to add proper range checking to prevent this vuln.
Fixes: 858e97d7956d ("media: dvb-usb: az6027: fix three null-ptr-deref in az6027_i2c_xfer()")
Signed-off-by: Jeongjun Park <aha310510@...il.com>
---
drivers/media/usb/dvb-usb/az6027.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/usb/dvb-usb/az6027.c b/drivers/media/usb/dvb-usb/az6027.c
index 056935d3cbd6..f9bd8a4c1577 100644
--- a/drivers/media/usb/dvb-usb/az6027.c
+++ b/drivers/media/usb/dvb-usb/az6027.c
@@ -988,7 +988,7 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n
/* write/read request */
if (i + 1 < num && (msg[i + 1].flags & I2C_M_RD)) {
req = 0xB9;
- if (msg[i].len < 1) {
+ if (msg[i].len < 1 || msg[i + 1].len + 5 > sizeof(data)) {
i = -EOPNOTSUPP;
break;
}
@@ -1005,7 +1005,7 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n
/* demod 16bit addr */
req = 0xBD;
- if (msg[i].len < 1) {
+ if (msg[i].len < 1 || msg[i].len - 2 > sizeof(data)) {
i = -EOPNOTSUPP;
break;
}
@@ -1034,7 +1034,7 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n
} else {
req = 0xBD;
- if (msg[i].len < 1) {
+ if (msg[i].len < 1 || msg[i].len - 1 > sizeof(data)) {
i = -EOPNOTSUPP;
break;
}
--
Powered by blists - more mailing lists