diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-08-07 15:00:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-08-07 19:12:03 -0400 |
commit | 749d00dbf154fc2f9ac59df669205039de0d5b45 (patch) | |
tree | 0099ed2a213c0b221e89a22a5b7a9611e11ddf0b | |
parent | 5fb4d2525b6dcffbb8bc26a7dfc7ed17ad323a06 (diff) |
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.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/rspiusb/rspiusb.c b/drivers/staging/rspiusb/rspiusb.c index 2f8155c1968b..04e2f92c0f62 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) | |||
716 | pdx->PixelUrb[frameInfo][i]->transfer_flags = | 716 | pdx->PixelUrb[frameInfo][i]->transfer_flags = |
717 | URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT; | 717 | URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT; |
718 | } | 718 | } |
719 | if (i == 0) | ||
720 | return -EINVAL; | ||
719 | /* only interrupt when last URB completes */ | 721 | /* only interrupt when last URB completes */ |
720 | pdx->PixelUrb[frameInfo][--i]->transfer_flags &= ~URB_NO_INTERRUPT; | 722 | pdx->PixelUrb[frameInfo][--i]->transfer_flags &= ~URB_NO_INTERRUPT; |
721 | pdx->pendedPixelUrbs[frameInfo] = | 723 | pdx->pendedPixelUrbs[frameInfo] = |