All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Markus Elfring <Markus.Elfring@web.de>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [V2 PATCH] usb: mtu3: fix NULL pointer dereference
Date: Thu, 09 Jul 2020 09:42:56 +0300	[thread overview]
Message-ID: <87imex6vf3.fsf@kernel.org> (raw)
In-Reply-To: <1593658371.23885.16.camel@mhfsdcap03>


[-- Attachment #1.1: Type: text/plain, Size: 952 bytes --]


Hi,

Chunfeng Yun <chunfeng.yun@mediatek.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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@kernel.org>
To: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Markus Elfring <Markus.Elfring@web.de>,
	linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [V2 PATCH] usb: mtu3: fix NULL pointer dereference
Date: Thu, 09 Jul 2020 09:42:56 +0300	[thread overview]
Message-ID: <87imex6vf3.fsf@kernel.org> (raw)
In-Reply-To: <1593658371.23885.16.camel@mhfsdcap03>

[-- Attachment #1: Type: text/plain, Size: 952 bytes --]


Hi,

Chunfeng Yun <chunfeng.yun@mediatek.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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@kernel.org>
To: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Markus Elfring <Markus.Elfring@web.de>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [V2 PATCH] usb: mtu3: fix NULL pointer dereference
Date: Thu, 09 Jul 2020 09:42:56 +0300	[thread overview]
Message-ID: <87imex6vf3.fsf@kernel.org> (raw)
In-Reply-To: <1593658371.23885.16.camel@mhfsdcap03>


[-- Attachment #1.1: Type: text/plain, Size: 952 bytes --]


Hi,

Chunfeng Yun <chunfeng.yun@mediatek.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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-07-09  6:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30  7:42 [V2 PATCH] usb: mtu3: fix NULL pointer dereference Chunfeng Yun
2020-06-30  7:42 ` Chunfeng Yun
2020-06-30  7:42 ` Chunfeng Yun
2020-06-30 10:47 ` [PATCH v2] usb: mtu3: Fix NULL pointer dereferences Markus Elfring
2020-06-30 10:47   ` Markus Elfring
2020-06-30 10:47   ` Markus Elfring
2020-06-30 10:47   ` Markus Elfring
2020-07-01 11:58 ` [V2 PATCH] usb: mtu3: fix NULL pointer dereference Greg Kroah-Hartman
2020-07-01 11:58   ` Greg Kroah-Hartman
2020-07-01 11:58   ` Greg Kroah-Hartman
2020-07-02  2:52   ` Chunfeng Yun
2020-07-02  2:52     ` Chunfeng Yun
2020-07-02  2:52     ` Chunfeng Yun
2020-07-09  6:42     ` Felipe Balbi [this message]
2020-07-09  6:42       ` Felipe Balbi
2020-07-09  6:42       ` Felipe Balbi
2020-07-09  6:40 ` Felipe Balbi
2020-07-09  6:40   ` Felipe Balbi
2020-07-09  6:40   ` Felipe Balbi
2020-07-09  7:05   ` Chunfeng Yun
2020-07-09  7:05     ` Chunfeng Yun
2020-07-09  7:05     ` Chunfeng Yun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imex6vf3.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=Markus.Elfring@web.de \
    --cc=chunfeng.yun@mediatek.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.