lkml.org 
[lkml]   [2015]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] USB: EHCI: fix dereference of ERR_PTR
From
Date
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



\
 
 \ /
  Last update: 2015-09-16 16:41    [W:0.081 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site