summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Chen <harperchen1110@gmail.com>2023-03-28 13:44:16 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-06-09 10:23:59 +0200
commit5eea76fe0c9818d82ae06ef96fddf95e2bcd2581 (patch)
treebdd90368968d43e833f72ccdc0adf522ef48de68
parent6249599d4110077af720884ec1a1877611005c1a (diff)
downloadlinux-stable-5eea76fe0c9818d82ae06ef96fddf95e2bcd2581.tar.gz
linux-stable-5eea76fe0c9818d82ae06ef96fddf95e2bcd2581.tar.bz2
linux-stable-5eea76fe0c9818d82ae06ef96fddf95e2bcd2581.zip
media: dvb-usb: dw2102: fix uninit-value in su3000_read_mac_address
[ Upstream commit a3fd1ef27aa686d871cefe207bd6168c4b0cd29e ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/media/usb/dvb-usb/dw2102.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
index ebb0c982a6f2..cd0566c0b3de 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -949,7 +949,7 @@ static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
for (i = 0; i < 6; i++) {
obuf[1] = 0xf0 + i;
if (i2c_transfer(&d->i2c_adap, msg, 2) != 2)
- break;
+ return -1;
else
mac[i] = ibuf[0];
}