Linux USB
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Andrey Strachuk <strochuk@ispras.ru>
Cc: Peter Chen <peter.chen@kernel.org>,
	Pawel Laszczak <pawell@cadence.com>,
	Roger Quadros <rogerq@kernel.org>,
	Aswath Govindraju <a-govindraju@ti.com>,
	Felipe Balbi <felipe.balbi@linux.intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: Re: [PATCH v2] usb: cdns3: change place of NULL check in cdns3_gadget_ep_enable()
Date: Fri, 19 Aug 2022 10:36:22 +0200	[thread overview]
Message-ID: <Yv9LhgZgDCdA0hG8@kroah.com> (raw)
In-Reply-To: <20220728163014.247082-1-strochuk@ispras.ru>

On Thu, Jul 28, 2022 at 07:30:14PM +0300, Andrey Strachuk wrote:
> If 'ep' is NULL, result of ep_to_cdns3_ep(ep) is invalid and
> priv_ep->cdns3_dev causes panic.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
> ---
>  drivers/usb/cdns3/cdns3-gadget.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

No information on what changed from v1 to v2 :(

> 
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index 5c15c48952a6..51de7457a3b8 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -2284,11 +2284,14 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep,
>  	int ret = 0;
>  	int val;
>  
> +	if (!ep)
> +		return -EINVAL;

How can ep ever be NULL at all?  Why does this need to be checked?

thanks,

greg k-h

      parent reply	other threads:[~2022-08-19  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <16589929667170@kroah.com>
2022-07-28 16:30 ` [PATCH v2] usb: cdns3: change place of NULL check in cdns3_gadget_ep_enable() Andrey Strachuk
2022-08-03 12:26   ` Roger Quadros
2022-08-19  8:36   ` Greg Kroah-Hartman [this message]

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=Yv9LhgZgDCdA0hG8@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=a-govindraju@ti.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    --cc=peter.chen@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=strochuk@ispras.ru \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox