All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 207125] New: Possible null pointer dereference in  ohci_restart()
@ 2020-04-05 17:31 bugzilla-daemon
  2020-04-06 14:20 ` [Bug 207125] " bugzilla-daemon
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-04-05 17:31 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=207125

            Bug ID: 207125
           Summary: Possible null pointer dereference in  ohci_restart()
           Product: Drivers
           Version: 2.5
    Kernel Version: Linux 4.17
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: USB
          Assignee: drivers_usb@kernel-bugs.kernel.org
          Reporter: zhandy@hit.edu.cn
        Regression: No

In Linux 4.17, ohci_restart() in /drivers/usb/host/ohci-hcd.c does not handle
the failure of ohci_init(), causing ohci->hcca could be a null pointer. After
that, writting to this ohci->hcca->int_table [i] field could cause a null
pointer dereference bug.

Url of ohci_restart()
https://elixir.bootlin.com/linux/v4.10.17/source/drivers/usb/host/ohci-hcd.c#L1000

int ohci_restart(struct ohci_hcd *ohci)
{
        ...
        ohci_init(ohci); //does not handle the failure
        ...
        for (i = 0; i < NUM_INTS; i++) ohci->hcca->int_table [i] = 0; //null
pointer dereference
        ...
}

Url of ohci_init()
https://elixir.bootlin.com/linux/v4.10.17/source/drivers/usb/host/ohci-hcd.c#L441
static int ohci_init (struct ohci_hcd *ohci)
{
...
ohci->hcca = dma_alloc_coherent (hcd->self.controller,
                        sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_KERNEL);
        if (!ohci->hcca)
                return -ENOMEM; // ohci->hcca can be a null pointer
...
}

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 207125] Possible null pointer dereference in  ohci_restart()
  2020-04-05 17:31 [Bug 207125] New: Possible null pointer dereference in ohci_restart() bugzilla-daemon
@ 2020-04-06 14:20 ` bugzilla-daemon
  2020-04-06 15:07 ` bugzilla-daemon
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-04-06 14:20 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=207125

Alan Stern (stern@rowland.harvard.edu) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stern@rowland.harvard.edu

--- Comment #1 from Alan Stern (stern@rowland.harvard.edu) ---
This is not a bug.  When ohci_restart() calls ohci_init(), ohci->hcca
has already been initialized to a non-NULL value.  Therefore the
-ENOMEM return cannot happen.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 207125] Possible null pointer dereference in  ohci_restart()
  2020-04-05 17:31 [Bug 207125] New: Possible null pointer dereference in ohci_restart() bugzilla-daemon
  2020-04-06 14:20 ` [Bug 207125] " bugzilla-daemon
@ 2020-04-06 15:07 ` bugzilla-daemon
  2020-04-06 15:41 ` bugzilla-daemon
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-04-06 15:07 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=207125

--- Comment #2 from Dongyang Zhan (zhandy@hit.edu.cn) ---
(In reply to Alan Stern from comment #1)
> This is not a bug.  When ohci_restart() calls ohci_init(), ohci->hcca
> has already been initialized to a non-NULL value.  Therefore the
> -ENOMEM return cannot happen.

ohci->hcca will be allocated again in the ohci_init()
Could it fail in that function?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 207125] Possible null pointer dereference in  ohci_restart()
  2020-04-05 17:31 [Bug 207125] New: Possible null pointer dereference in ohci_restart() bugzilla-daemon
  2020-04-06 14:20 ` [Bug 207125] " bugzilla-daemon
  2020-04-06 15:07 ` bugzilla-daemon
@ 2020-04-06 15:41 ` bugzilla-daemon
  2020-04-06 16:12 ` bugzilla-daemon
  2020-04-06 16:34 ` bugzilla-daemon
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-04-06 15:41 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=207125

--- Comment #3 from Dongyang Zhan (zhandy@hit.edu.cn) ---
(In reply to Alan Stern from comment #1)
> This is not a bug.  When ohci_restart() calls ohci_init(), ohci->hcca
> has already been initialized to a non-NULL value.  Therefore the
> -ENOMEM return cannot happen.

I mean could you tell me where ohci->hcca is initialized before ohci_restart()?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 207125] Possible null pointer dereference in  ohci_restart()
  2020-04-05 17:31 [Bug 207125] New: Possible null pointer dereference in ohci_restart() bugzilla-daemon
                   ` (2 preceding siblings ...)
  2020-04-06 15:41 ` bugzilla-daemon
@ 2020-04-06 16:12 ` bugzilla-daemon
  2020-04-06 16:34 ` bugzilla-daemon
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-04-06 16:12 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=207125

--- Comment #4 from Alan Stern (stern@rowland.harvard.edu) ---
ohci->hcca is initialized when ohci_setup() calls ohci_init().  This happens
long before ohci_restart() will ever get called.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 207125] Possible null pointer dereference in  ohci_restart()
  2020-04-05 17:31 [Bug 207125] New: Possible null pointer dereference in ohci_restart() bugzilla-daemon
                   ` (3 preceding siblings ...)
  2020-04-06 16:12 ` bugzilla-daemon
@ 2020-04-06 16:34 ` bugzilla-daemon
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon @ 2020-04-06 16:34 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=207125

Dongyang Zhan (zhandy@hit.edu.cn) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WILL_NOT_FIX

--- Comment #5 from Dongyang Zhan (zhandy@hit.edu.cn) ---
(In reply to Alan Stern from comment #4)
> ohci->hcca is initialized when ohci_setup() calls ohci_init().  This happens
> long before ohci_restart() will ever get called.

Thank you so much.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-06 16:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05 17:31 [Bug 207125] New: Possible null pointer dereference in ohci_restart() bugzilla-daemon
2020-04-06 14:20 ` [Bug 207125] " bugzilla-daemon
2020-04-06 15:07 ` bugzilla-daemon
2020-04-06 15:41 ` bugzilla-daemon
2020-04-06 16:12 ` bugzilla-daemon
2020-04-06 16:34 ` bugzilla-daemon

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.