Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755124AbcKCNeb (ORCPT ); Thu, 3 Nov 2016 09:34:31 -0400 Received: from mga04.intel.com ([192.55.52.120]:57363 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750979AbcKCNea (ORCPT ); Thu, 3 Nov 2016 09:34:30 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,438,1473145200"; d="asc'?scan'208";a="897291308" From: Felipe Balbi To: Alexey Khoroshilov Cc: Alexey Khoroshilov , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: Re: [PATCH v2 1/2] usb: gadget: mv_u3d: add check for dma mapping error In-Reply-To: <1478178992-28317-1-git-send-email-khoroshilov@ispras.ru> References: <871sytndwo.fsf@linux.intel.com> <1478178992-28317-1-git-send-email-khoroshilov@ispras.ru> Date: Thu, 03 Nov 2016 15:34:00 +0200 Message-ID: <87zilgk7qv.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2373 Lines: 72 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Alexey Khoroshilov writes: > mv_u3d_req_to_trb() does not check for dma mapping errors. > > Found by Linux Driver Verification project (linuxtesting.org). > > v2: split fix and clenup to separate patches. I'll fix this time when applying, but keep in mind we don't want these notes in the commit log. They should come after the tearline (---) below, together with the diffstat ;-) > Signed-off-by: Alexey Khoroshilov > --- > drivers/usb/gadget/udc/mv_u3d_core.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/ud= c/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; > + } >=20=20 > req->chain =3D 1; > } > --=20 > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJYGzzIAAoJEMy+uJnhGpkG8TUP/iiA4+5TDTl/FZhtwmpQ7VOE Clz03s8+EJZ8sDC1Yb5Z28d6goCS5n7yDU4/XELW8DJLNqcr5DV4BZNVXMWiYlLp yUBcXZI/rz7rUHfU+xZYKfJpPNhuLOg0c4gasHZlYG5yhf7gxEFj/ZYH/Afw2LcJ EtJlV+wYvQuQGhs45akciyHbiiU2cpdTVg1C0XtyBygh6UF7EVTnSdXMIhfaU10A 5rw66gC4fbORDQ214lohS34pvOoRn5UFk8k0IxTho/E0hPodC28ZBbfKh5emuOhq EPxV0HznCVzvJRVbCob1571nyRYJtHW0nbx3gWUoHOkm9a7NFZSEIfaYTOM88/Cn aLyc/EPI+2vKGdZX+vsvRhXFHyOqoSUV8EQ8nOAtga+8X948urdppttENlQ/gELt 1VWC/77XfIeGYgaZqKTRT6uv0PSzJkJFSWnp5i6/DbPc4agIZcXwL/8P/lIUmD/H kDywsf43YgT7kOXCaPitdrc33/o3J0KTHz5Px7ER+ZIET0zLItLhVpAUh2Lev2YJ nLFUKzeZw39sF5UxT6AlIBXGN2eLXNQ9BxFjEYGGzkv9CDX4C89MgavQ9Iv4yJYr 7f2Skg/RVqjF5O66xs1zTRF9lrZrs1cxVuU/IgoE8tRrunqzhWcq9EcRf4c3dR+7 LO1Z53GlDzSScjkRSf2X =/EWD -----END PGP SIGNATURE----- --=-=-=--