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: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
parent
5eb30cedce
commit
6ffd65154e
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue