From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrice CHOTARD Date: Fri, 27 Apr 2018 07:52:35 +0000 Subject: [U-Boot] [PATCH] usb: gadget: composite: fix NULL pointer when a non standard request is received In-Reply-To: <20180426151744.30676f73@jawa> References: <1521102857-6497-1-git-send-email-patrice.chotard@st.com> <3793e5c6-a0fb-98f7-08e6-f4f87f0ca463@st.com> <20180426151744.30676f73@jawa> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Thanks Lukasz ;-) On 04/26/2018 03:17 PM, Lukasz Majewski wrote: > Hi Patrice, > >> Hi >> >> It's a gentle reminder as this patch is present on mailing list since >> 5 weeks without any feedback. > > Deepest apologizes for the delay. > > I will test this patch - as some Samsung SoCs may use this feature and > let you know. > >> >> Thanks >> >> On 03/15/2018 09:34 AM, patrice.chotard at st.com wrote: >>> From: Christophe Kerello >>> >>> In case usb configuration is unknown (cdev->config == NULL), non >>> standard request should not be processed. >>> Remove also the cdev->config check below which will never happen. >>> >>> This issue was seen using ums feature. >>> >>> Signed-off-by: Christophe Kerello >>> Signed-off-by: Patrice Chotard >>> --- >>> drivers/usb/gadget/composite.c | 5 ++++- >>> 1 file changed, 4 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/usb/gadget/composite.c >>> b/drivers/usb/gadget/composite.c index d0ee7847b98d..a87639def974 >>> 100644 --- a/drivers/usb/gadget/composite.c >>> +++ b/drivers/usb/gadget/composite.c >>> @@ -838,6 +838,9 @@ unknown: >>> ctrl->bRequestType, ctrl->bRequest, >>> w_value, w_index, w_length); >>> >>> + if (!cdev->config) >>> + goto done; >>> + >>> /* >>> * functions always handle their interfaces and >>> endpoints... >>> * punt other recipients (other, WUSB, ...) to >>> the current @@ -882,7 +885,7 @@ unknown: >>> value = f->setup(f, ctrl); >>> else { >>> c = cdev->config; >>> - if (c && c->setup) >>> + if (c->setup) >>> value = c->setup(c, ctrl); >>> } >>> >>> > > > > > Best regards, > > Lukasz Majewski > > -- > > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de >