All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] USB: EHCI: fix dereference of ERR_PTR
Date: Wed, 16 Sep 2015 17:25:31 +0300	[thread overview]
Message-ID: <55F97BDB.8080106@cogentembedded.com> (raw)
In-Reply-To: <1442412485-1944-1-git-send-email-sudipm.mukherjee@gmail.com>

Hello.

On 9/16/2015 5:08 PM, Sudip Mukherjee wrote:

> On error find_tt() returns either a NULL pointer or the error value in
> ERR_PTR. But we were dereferencing it directly without even checking if
> find_tt() returned a valid pointer or not.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>   drivers/usb/host/ehci-sched.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
> index f9a3327..27bced7 100644
> --- a/drivers/usb/host/ehci-sched.c
> +++ b/drivers/usb/host/ehci-sched.c
> @@ -257,6 +257,8 @@ static void reserve_release_intr_bandwidth(struct ehci_hcd *ehci,
>   	/* FS/LS bus bandwidth */
>   	if (tt_usecs) {
>   		tt = find_tt(qh->ps.udev);
> +		if (!tt || IS_ERR(tt))

    There's IS_ERR_OR_NULL()?

> +			return;
>   		if (sign > 0)
>   			list_add_tail(&qh->ps.ps_list, &tt->ps_list);
>   		else
> @@ -1373,6 +1375,8 @@ static void reserve_release_iso_bandwidth(struct ehci_hcd *ehci,
>   		}
>
>   		tt = find_tt(stream->ps.udev);
> +		if (!tt || IS_ERR(tt))

    Likewise.

[...]

MBR, Sergei


  parent reply	other threads:[~2015-09-16 14:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 14:08 [PATCH] USB: EHCI: fix dereference of ERR_PTR Sudip Mukherjee
2015-09-16 14:16 ` Fabio Estevam
2015-09-16 14:25 ` Sergei Shtylyov [this message]
2015-09-16 16:22 ` [PATCH v2] " Sudip Mukherjee
2015-09-16 16:54   ` Alan Stern
2015-09-18  5:48     ` Sudip Mukherjee
2015-09-18 14:45       ` Alan Stern
2015-09-21  2:48 ` [PATCH] " Lu, Baolu
2015-09-21  4:49   ` Sudip Mukherjee

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=55F97BDB.8080106@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=sudipm.mukherjee@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.