Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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>

authored by

Sean Young and committed by
Mauro Carvalho Chehab
26cff637 51d0c99b

+14 -7
+14 -7
drivers/media/usb/dvb-usb/vp7045.c
··· 96 96 97 97 static int vp7045_rc_query(struct dvb_usb_device *d) 98 98 { 99 + int ret; 99 100 u8 key; 100 - vp7045_usb_op(d,RC_VAL_READ,NULL,0,&key,1,20); 101 101 102 - deb_rc("remote query key: %x %d\n",key,key); 102 + ret = vp7045_usb_op(d, RC_VAL_READ, NULL, 0, &key, 1, 20); 103 + if (ret) 104 + return ret; 105 + 106 + deb_rc("remote query key: %x\n", key); 103 107 104 108 if (key != 0x44) { 105 109 /* ··· 119 115 120 116 static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset) 121 117 { 122 - int i = 0; 123 - u8 v,br[2]; 118 + int i, ret; 119 + u8 v, br[2]; 124 120 for (i=0; i < len; i++) { 125 121 v = offset + i; 126 - vp7045_usb_op(d,GET_EE_VALUE,&v,1,br,2,5); 122 + ret = vp7045_usb_op(d, GET_EE_VALUE, &v, 1, br, 2, 5); 123 + if (ret) 124 + return ret; 125 + 127 126 buf[i] = br[1]; 128 127 } 129 - deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ",offset, i); 130 - debug_dump(buf,i,deb_info); 128 + deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ", offset, i); 129 + debug_dump(buf, i, deb_info); 131 130 return 0; 132 131 } 133 132