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 12:52:13 +0200 |
commit | 6ffd65154e23a4cf5d2da400e0fa7142a4474b98 (patch) | |
tree | 445894e36ae4594b2942294832d2a15f7ed12c8c /drivers/usb/gadget/udc/mv_u3d_core.c | |
parent | 5eb30cedced64cea63005555c1ef67359ffe191f (diff) | |
download | op-kernel-dev-6ffd65154e23a4cf5d2da400e0fa7142a4474b98.zip op-kernel-dev-6ffd65154e23a4cf5d2da400e0fa7142a4474b98.tar.gz |
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/mv_u3d_core.c')
-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 b9e19a5..6f3be0b 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; } |