Patch "[media] dw2102: limit messages to buffer size" has been added to the 4.11-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
[media] dw2102: limit messages to buffer size
to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
dw2102-limit-messages-to-buffer-size.patch
and it can be found in the queue-4.11 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
950e252cb469f323740d78e4907843acef89eedbMon Sep 17 00:00:00 2001
From: Alyssa Milburn <[email protected]>
Date: Sat, 1 Apr 2017 14:34:49 -0300
Subject: [media] dw2102: limit messages to buffer size
From: Alyssa Milburn <[email protected]>
commit 950e252cb469f323740d78e4907843acef89eedb upstream.
Otherwise the i2c transfer functions can read or write beyond the end of stack or heap buffers.
--- drivers/media/usb/dvb-usb/dw2102.c | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
drivers/media/usb/dvb-usb/dw2102.c +54 -0
@@ -204,6 +204,20 @@ static int dw2102_serit_i2c_transfer(strswitch (num) {case 2 : +if (msg[0 ].len !=1 ) { +warn ("i2c rd: len=%d is not 1!\n" , + msg[0 ].len); + num = -EOPNOTSUPP ; +break ; + } + +if (2 + msg[1 ].len >sizeof (buf6)) { +warn ("i2c rd: len=%d is too big!\n" , + msg[1 ].len); + num = -EOPNOTSUPP ; +break ; + } +/* read si2109 register by number */ buf6[0 ] = msg[0 ].addr <<1 ; buf6[1 ] = msg[0 ].len;
@@ -219,6 +233,13 @@ static int dw2102_serit_i2c_transfer(strcase 1 :switch (msg[0 ].addr) {case 0x68 : +if (2 + msg[0 ].len >sizeof (buf6)) { +warn ("i2c wr: len=%d is too big!\n" , + msg[0 ].len); + num = -EOPNOTSUPP ; +break ; + } +/* write to si2109 register */ buf6[0 ] = msg[0 ].addr <<1 ; buf6[1 ] = msg[0 ].len;
@@ -262,6 +283,13 @@ static int dw2102_earda_i2c_transfer(str/* first write first register number */ u8 ibuf[MAX_XFER_SIZE ], obuf[3 ]; +if (2 + msg[0 ].len !=sizeof (obuf)) { +warn ("i2c rd: len=%d is not 1!\n" , + msg[0 ].len); + ret = -EOPNOTSUPP ; + goto unlock; + } +if (2 + msg[1 ].len >sizeof (ibuf)) {warn ("i2c rd: len=%d is too big!\n" , msg[1 ].len);
@@ -462,6 +490,12 @@ static int dw3101_i2c_transfer(struct i2/* first write first register number */ u8 ibuf[MAX_XFER_SIZE ], obuf[3 ]; +if (2 + msg[0 ].len !=sizeof (obuf)) { +warn ("i2c rd: len=%d is not 1!\n" , + msg[0 ].len); + ret = -EOPNOTSUPP ; + goto unlock; + }if (2 + msg[1 ].len >sizeof (ibuf)) {warn ("i2c rd: len=%d is too big!\n" , msg[1 ].len);
@@ -696,6 +730,13 @@ static int su3000_i2c_transfer(struct i2 msg[0 ].buf[0 ] = state->data[1 ];break ;default : +if (3 + msg[0 ].len >sizeof (state->data)) { +warn ("i2c wr: len=%d is too big!\n" , + msg[0 ].len); + num = -EOPNOTSUPP ; +break ; + } +/* always i2c write*/ state->data[0 ] =0x08 ; state->data[1 ] = msg[0 ].addr;
@@ -711,6 +752,19 @@ static int su3000_i2c_transfer(struct i2break ;case 2 :/* always i2c read */ +if (4 + msg[0 ].len >sizeof (state->data)) { +warn ("i2c rd: len=%d is too big!\n" , + msg[0 ].len); + num = -EOPNOTSUPP ; +break ; + } +if (1 + msg[1 ].len >sizeof (state->data)) { +warn ("i2c rd: len=%d is too big!\n" , + msg[1 ].len); + num = -EOPNOTSUPP ; +break ; + } + state->data[0 ] =0x09 ; state->data[1 ] = msg[0 ].len; state->data[2 ] = msg[1 ].len;
Patches currently in stable-queue which might be from [email protected] are
queue-4.11/digitv-limit-messages-to-buffer-size.patch queue-4.11/ttusb2-limit-messages-to-buffer-size.patch queue-4.11/zr364xx-enforce-minimum-size-when-reading-header.patch queue-4.11/dw2102-limit-messages-to-buffer-size.patch