projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6a3ae84
)
USB: keyspan: add a sanity test on "len"
author
Dan Carpenter
<
[email protected]
>
Fri, 5 Apr 2013 05:43:20 +0000
(08:43 +0300)
committer
Greg Kroah-Hartman
<
[email protected]
>
Fri, 5 Apr 2013 21:11:25 +0000
(14:11 -0700)
"len" comes from the USB transfer and it's probably correct. The thing
is that we already have similar checks like:
if (data[i] >= serial->num_ports) {
So adding a sanity test here matches the rest of the code and is a good
idea.
Signed-off-by: Dan Carpenter <
[email protected]
>
Signed-off-by: Greg Kroah-Hartman <
[email protected]
>
drivers/usb/serial/keyspan.c
patch
|
blob
|
history
diff --git
a/drivers/usb/serial/keyspan.c
b/drivers/usb/serial/keyspan.c
index 3d92394aba3a28770d10abf7064a724cc87b4d69..025310bc358a929d9a02ec7300a9c3609f1d025e 100644
(file)
--- a/
drivers/usb/serial/keyspan.c
+++ b/
drivers/usb/serial/keyspan.c
@@
-741,14
+741,15
@@
static void usa49wg_indat_callback(struct urb *urb)
if ((data[i] & 0x80) == 0) {
/* no error on any byte */
i++;
- for (x = 1; x < len ; ++x)
+ for (x = 1; x < len
&& i < urb->actual_length
; ++x)
tty_insert_flip_char(&port->port,
data[i++], 0);
} else {
/*
* some bytes had errors, every byte has status
*/
- for (x = 0; x + 1 < len; x += 2) {
+ for (x = 0; x + 1 < len &&
+ i + 1 < urb->actual_length; x += 2) {
int stat = data[i], flag = 0;
if (stat & RXERROR_OVERRUN)