diff options
author | Simon Arlott <simon@fire.lp0.eu> | 2009-11-21 10:07:14 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:52:58 -0500 |
commit | 5d0a9c7932c45435de72b5a5b2825c7eb34186a4 (patch) | |
tree | bc35d2d276ffd5b00b1d73b3946155ad5c1a9e23 /drivers/usb/atm | |
parent | 1bfbd283cd3082b6cadfbf340faf7d35b8a36b83 (diff) |
USB: cxacru: check data length is not negative
When attempting to read data that is not actually
an array of values, the length may be negative
which causes an Oops due to a likely access off
the end of the data array.
This bug should not occur under normal use unless
the device returns an invalid response.
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/atm')
-rw-r--r-- | drivers/usb/atm/cxacru.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index 4a26a6c93bec..8da4a06bf140 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -596,7 +596,7 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ | |||
596 | len = ret / 4; | 596 | len = ret / 4; |
597 | for (offb = 0; offb < len; ) { | 597 | for (offb = 0; offb < len; ) { |
598 | int l = le32_to_cpu(buf[offb++]); | 598 | int l = le32_to_cpu(buf[offb++]); |
599 | if (l > stride || l > (len - offb) / 2) { | 599 | if (l < 0 || l > stride || l > (len - offb) / 2) { |
600 | if (printk_ratelimit()) | 600 | if (printk_ratelimit()) |
601 | usb_err(instance->usbatm, "invalid data length from cm %#x: %d\n", | 601 | usb_err(instance->usbatm, "invalid data length from cm %#x: %d\n", |
602 | cm, l); | 602 | cm, l); |