Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;
	}