Commit 6ffd6515 authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Felipe Balbi

usb: gadget: mv_u3d: add check for dma mapping error

mv_u3d_req_to_trb() does not check for dma mapping errors.

Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 5eb30ced
......@@ -462,6 +462,12 @@ static int mv_u3d_req_to_trb(struct mv_u3d_req *req)
req->trb_head->trb_hw,
trb_num * sizeof(*trb_hw),
DMA_BIDIRECTIONAL);
if (dma_mapping_error(u3d->gadget.dev.parent,
req->trb_head->trb_dma)) {
kfree(req->trb_head->trb_hw);
kfree(req->trb_head);
return -EFAULT;
}
req->chain = 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment