[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87imex6vf3.fsf@kernel.org>
Date: Thu, 09 Jul 2020 09:42:56 +0300
From: Felipe Balbi <balbi@...nel.org>
To: Chunfeng Yun <chunfeng.yun@...iatek.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Felipe Balbi <felipe.balbi@...ux.intel.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Markus Elfring <Markus.Elfring@....de>,
linux-usb@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [V2 PATCH] usb: mtu3: fix NULL pointer dereference
Hi,
Chunfeng Yun <chunfeng.yun@...iatek.com> writes:
>> > @@ -373,8 +380,8 @@ static int mtu3_gadget_dequeue(struct usb_ep *ep, struct usb_request *req)
>> > */
>> > static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value)
>> > {
>> > - struct mtu3_ep *mep = to_mtu3_ep(ep);
>> > - struct mtu3 *mtu = mep->mtu;
>> > + struct mtu3_ep *mep;
>> > + struct mtu3 *mtu;
>> > struct mtu3_request *mreq;
>> > unsigned long flags;
>> > int ret = 0;
>> > @@ -382,6 +389,9 @@ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value)
>> > if (!ep)
>> > return -EINVAL;
>>
>> Same here, how can that ever happen?
> Maybe when the class driver has something wrong:)
>
> You mean it's better to remove these unnecessary checks?
if we need those checks, I'd rather have them at a central location,
such as udc/core.c. But, as Greg mentioned, the kernel doesn't call
these with NULL pointers.
--
balbi
Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)
Powered by blists - more mailing lists