mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 21:57:43 +00:00
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
1 changed files with 6 additions and 0 deletions
|
@ -462,6 +462,12 @@ static int mv_u3d_req_to_trb(struct mv_u3d_req *req)
|
||||||
req->trb_head->trb_hw,
|
req->trb_head->trb_hw,
|
||||||
trb_num * sizeof(*trb_hw),
|
trb_num * sizeof(*trb_hw),
|
||||||
DMA_BIDIRECTIONAL);
|
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;
|
req->chain = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue