mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-18 15:28:43 +00:00
DM USB: Fix potential crash issues.
This patch fix some potential crash issues, like wild pointers access, buffer overflow and etc. Change-Id: Iddd8e1820da426adc6b9b4d9da9e44017d9f365c Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Reviewed-by: Yu Wang <yu1.wang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -149,7 +149,7 @@ usb_dev_prepare_xfer(struct usb_data_xfer *xfer, int *count, int *size)
|
||||
found = 0;
|
||||
first = -1;
|
||||
c = s = 0;
|
||||
if (!count || !size)
|
||||
if (!count || !size || idx < 0 || idx >= USB_MAX_XFER_BLOCKS)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < xfer->ndata; i++) {
|
||||
@@ -452,6 +452,10 @@ usb_dev_prepare_ctrl_xfer(struct usb_data_xfer *xfer)
|
||||
struct usb_data_xfer_block *blk = NULL;
|
||||
|
||||
idx = xfer->head;
|
||||
|
||||
if (idx < 0 || idx >= USB_MAX_XFER_BLOCKS)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < xfer->ndata; i++) {
|
||||
/*
|
||||
* find out the data block and set every
|
||||
|
Reference in New Issue
Block a user