summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-08-07 21:00:10 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2009-08-07 16:12:03 -0700
commit749d00dbf154fc2f9ac59df669205039de0d5b45 (patch)
tree0099ed2a213c0b221e89a22a5b7a9611e11ddf0b
parent5fb4d2525b6dcffbb8bc26a7dfc7ed17ad323a06 (diff)
downloadlinux-3.10-749d00dbf154fc2f9ac59df669205039de0d5b45.tar.gz
linux-3.10-749d00dbf154fc2f9ac59df669205039de0d5b45.tar.bz2
linux-3.10-749d00dbf154fc2f9ac59df669205039de0d5b45.zip
Staging: rspiusb: Fix buffer overflow
usb_buffer_map_sg() may return -1. This will result in a read from pdx->PixelUrb[frameInfo][-1] Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/rspiusb/rspiusb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/rspiusb/rspiusb.c b/drivers/staging/rspiusb/rspiusb.c
index 2f8155c1968..04e2f92c0f6 100644
--- a/drivers/staging/rspiusb/rspiusb.c
+++ b/drivers/staging/rspiusb/rspiusb.c
@@ -716,6 +716,8 @@ static int MapUserBuffer(struct ioctl_struct *io, struct device_extension *pdx)
pdx->PixelUrb[frameInfo][i]->transfer_flags =
URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT;
}
+ if (i == 0)
+ return -EINVAL;
/* only interrupt when last URB completes */
pdx->PixelUrb[frameInfo][--i]->transfer_flags &= ~URB_NO_INTERRUPT;
pdx->pendedPixelUrbs[frameInfo] =