Skip to content

Commit fc3d19b

Browse files
xiaoguangwuacrnsi
authored andcommitted
DM USB: fix potential crash risk due to null pointer
Fix potential risk to crash due to null pointer. Tracked-On: #3612 Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
1 parent 4a71a16 commit fc3d19b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

devicemodel/hw/platform/usb_pmapper.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,11 @@ usb_dev_request(void *pdata, struct usb_data_xfer *xfer)
962962

963963
blk = usb_dev_prepare_ctrl_xfer(xfer);
964964
data = blk ? blk->buf : NULL;
965+
if (data == NULL) {
966+
xfer->status = USB_ERR_IOERROR;
967+
UPRINTF(LFTL, "%s unexpected NULL data\r\n", __func__);
968+
goto out;
969+
}
965970

966971
UPRINTF(LDBG, "%d-%s: urb: type 0x%x req 0x%x val 0x%x idx %d len %d "
967972
"data %d\r\n", udev->info.path.bus,

0 commit comments

Comments
 (0)