linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: linux-usb@vger.kernel.org
Subject: [Bug 207125] New: Possible null pointer dereference in  ohci_restart()
Date: Sun, 05 Apr 2020 17:31:15 +0000	[thread overview]
Message-ID: <bug-207125-208809@https.bugzilla.kernel.org/> (raw)

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.

             reply	other threads:[~2020-04-05 17:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-05 17:31 bugzilla-daemon [this message]
2020-04-06 14:20 ` [Bug 207125] Possible null pointer dereference in ohci_restart() 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

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=bug-207125-208809@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).