media: vp7045: do not read uninitialized values if usb transfer fails

commit 26cff63712 upstream.

It is not a fatal error if reading the mac address or the remote control
decoder state fails.

Reported-by: syzbot+ec869945d3dde5f33b43@syzkaller.appspotmail.com
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Sean Young 2019-11-10 11:25:13 +01:00 committed by Greg Kroah-Hartman
parent 0c7cc4c9c2
commit d35ef79fbc
1 changed files with 14 additions and 7 deletions

View File

@ -96,10 +96,14 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff)
static int vp7045_rc_query(struct dvb_usb_device *d) static int vp7045_rc_query(struct dvb_usb_device *d)
{ {
int ret;
u8 key; u8 key;
vp7045_usb_op(d,RC_VAL_READ,NULL,0,&key,1,20);
deb_rc("remote query key: %x %d\n",key,key); ret = vp7045_usb_op(d, RC_VAL_READ, NULL, 0, &key, 1, 20);
if (ret)
return ret;
deb_rc("remote query key: %x\n", key);
if (key != 0x44) { if (key != 0x44) {
/* /*
@ -115,15 +119,18 @@ static int vp7045_rc_query(struct dvb_usb_device *d)
static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset) static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset)
{ {
int i = 0; int i, ret;
u8 v,br[2]; u8 v, br[2];
for (i=0; i < len; i++) { for (i=0; i < len; i++) {
v = offset + i; v = offset + i;
vp7045_usb_op(d,GET_EE_VALUE,&v,1,br,2,5); ret = vp7045_usb_op(d, GET_EE_VALUE, &v, 1, br, 2, 5);
if (ret)
return ret;
buf[i] = br[1]; buf[i] = br[1];
} }
deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ",offset, i); deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ", offset, i);
debug_dump(buf,i,deb_info); debug_dump(buf, i, deb_info);
return 0; return 0;
} }