diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2016-11-03 16:16:31 +0300 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-11-08 13:52:13 +0300 |
commit | 6ffd65154e23a4cf5d2da400e0fa7142a4474b98 (patch) | |
tree | 445894e36ae4594b2942294832d2a15f7ed12c8c /drivers/usb/gadget/udc | |
parent | 5eb30cedced64cea63005555c1ef67359ffe191f (diff) | |
download | linux-6ffd65154e23a4cf5d2da400e0fa7142a4474b98.tar.xz |
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>
Diffstat (limited to 'drivers/usb/gadget/udc')
-rw-r--r-- | drivers/usb/gadget/udc/mv_u3d_core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c index b9e19a591322..6f3be0ba9ac8 100644 --- a/drivers/usb/gadget/udc/mv_u3d_core.c +++ b/drivers/usb/gadget/udc/mv_u3d_core.c @@ -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; } |