Lucene search

K
vulnrichmentLinuxVULNRICHMENT:CVE-2021-46941
HistoryFeb 27, 2024 - 6:40 p.m.

CVE-2021-46941 usb: dwc3: core: Do core softreset when switch mode

2024-02-2718:40:28
Linux
github.com
4
linux kernel
usb
core softreset
mode switch
controller
vulnerability
programming guide
host
device
fix
clock synchronization

AI Score

6.7

Confidence

Low

SSVC

Exploitation

none

Automatable

no

Technical Impact

partial

In the Linux kernel, the following vulnerability has been resolved:

usb: dwc3: core: Do core softreset when switch mode

According to the programming guide, to switch mode for DRD controller,
the driver needs to do the following.

To switch from device to host:

  1. Reset controller with GCTL.CoreSoftReset
  2. Set GCTL.PrtCapDir(host mode)
  3. Reset the host with USBCMD.HCRESET
  4. Then follow up with the initializing host registers sequence

To switch from host to device:

  1. Reset controller with GCTL.CoreSoftReset
  2. Set GCTL.PrtCapDir(device mode)
  3. Reset the device with DCTL.CSftRst
  4. Then follow up with the initializing registers sequence

Currently we’re missing step 1) to do GCTL.CoreSoftReset and step 3) of
switching from host to device. John Stult reported a lockup issue seen
with HiKey960 platform without these steps[1]. Similar issue is observed
with Ferry’s testing platform[2].

So, apply the required steps along with some fixes to Yu Chen’s and John
Stultz’s version. The main fixes to their versions are the missing wait
for clocks synchronization before clearing GCTL.CoreSoftReset and only
apply DCTL.CSftRst when switching from host to device.

[1] https://lore.kernel.org/linux-usb/[email protected]/
[2] https://lore.kernel.org/linux-usb/[email protected]/

CNA Affected

[
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "41ce1456e1db",
        "lessThan": "fce7bbcd07d5",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "41ce1456e1db",
        "lessThan": "800f58217626",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "41ce1456e1db",
        "lessThan": "1c10fd60c859",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "41ce1456e1db",
        "lessThan": "f88359e1588b",
        "versionType": "git"
      }
    ],
    "programFiles": [
      "drivers/usb/dwc3/core.c",
      "drivers/usb/dwc3/core.h"
    ],
    "defaultStatus": "unaffected"
  },
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "4.12"
      },
      {
        "status": "unaffected",
        "version": "0",
        "lessThan": "4.12",
        "versionType": "custom"
      },
      {
        "status": "unaffected",
        "version": "5.10.36",
        "versionType": "custom",
        "lessThanOrEqual": "5.10.*"
      },
      {
        "status": "unaffected",
        "version": "5.11.20",
        "versionType": "custom",
        "lessThanOrEqual": "5.11.*"
      },
      {
        "status": "unaffected",
        "version": "5.12.3",
        "versionType": "custom",
        "lessThanOrEqual": "5.12.*"
      },
      {
        "status": "unaffected",
        "version": "5.13",
        "versionType": "original_commit_for_fix",
        "lessThanOrEqual": "*"
      }
    ],
    "programFiles": [
      "drivers/usb/dwc3/core.c",
      "drivers/usb/dwc3/core.h"
    ],
    "defaultStatus": "affected"
  }
]

AI Score

6.7

Confidence

Low

SSVC

Exploitation

none

Automatable

no

Technical Impact

partial