CVE-2022-48838 json
usb: gadget: Fix use-after-free bug by not setting udc->dev.driver
published 2024-07-16 2 y ago modified 2026-06-17 4 mo ago also EUVD-2022-53717
- cvss
- 5.5
- version 3.1, NVD
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.2%
- EPSS 0.2% chance of exploitation in 30 days, percentile 14%
- public exploits
- 0
- none known
Summary
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: Fix use-after-free bug by not setting udc->dev.driver
The syzbot fuzzer found a use-after-free bug:
BUG: KASAN: use-after-free in dev_uevent+0x712/0x780 drivers/base/core.c:2320 Read of size 8 at addr ffff88802b934098 by task udevd/3689
CPU: 2 PID: 3689 Comm: udevd Not tainted 5.17.0-rc4-syzkaller-00229-g4f12b742eb2b #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x303 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 dev_uevent+0x712/0x780 drivers/base/core.c:2320 uevent_show+0x1b8/0x380 drivers/base/core.c:2391 dev_attr_show+0x4b/0x90 drivers/base/core.c:2094
Although the bug manifested in the driver core, the real cause was a race with the gadget core. dev_uevent() does:
if (dev->driver) add_uevent_var(env, "DRIVER=%s", dev->driver->name);
and between the test and the dereference of dev->driver, the gadget core sets dev->driver to NULL.
The race wouldn't occur if the gadget core registered its devices on a real bus, using the standard synchronization techniques of the driver core. However, it's not necessary to make such a large change in order to fix this bug; all we need to do is make sure that udc->dev.driver is always NULL.
In fact, there is no reason for udc->dev.driver ever to be set to anything, let alone to the value it currently gets: the address of the gadget's driver. After all, a gadget driver only knows how to manage a gadget, not how to manage a UDC.
This patch simply removes the statements in the gadget core that touch udc->dev.driver.
Patch / fix
- Linux Linux 4.9.308, 4.14.273, 4.19.236, 5.4.187, 5.10.108, 5.15.31, 5.16.17, 5.17
- linux Debian 14, Debian 13, Debian 12 5.17.3-1
debian advisories DEBIAN-CVE-2022-48838
- linux Ubuntu 18.04 LTS 4.15.0-184.194
- linux Ubuntu 20.04 LTS 5.4.0-117.132
- linux Ubuntu 22.04 LTS 5.15.0-37.39
- linux-aws Ubuntu 18.04 LTS 4.15.0-1133.143
- linux-aws Ubuntu 20.04 LTS 5.4.0-1078.84
- linux-aws Ubuntu 22.04 LTS 5.15.0-1011.14
- linux-gcp Ubuntu 20.04 LTS 5.4.0-1078.84
- linux-gcp Ubuntu 22.04 LTS 5.15.0-1008.12
ubuntu advisories UBUNTU-CVE-2022-48838
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
- kernel-64kb SLES 15 SP3-LTSS, SLE High Performance Computing 15 SP3-LTSS, Enterprise Storage 7.1 5.3.18-150300.59.174.1
- kernel-syms SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE High Performance Computing 15 SP3-LTSS +1 more 5.3.18-150300.59.174.1
- kernel-source SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE High Performance Computing 15 SP3-LTSS +1 more 5.3.18-150300.59.174.1
- kernel-default SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE Micro 5.2 +5 more 5.3.18-150300.59.174.1
- kernel-preempt SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE High Performance Computing 15 SP3-LTSS +1 more 5.3.18-150300.59.174.1
- kernel-obs-build SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE High Performance Computing 15 SP3-LTSS +1 more 5.3.18-150300.59.174.1
- kernel-default-base SLES for SAP 15 SP3, SLES 15 SP3-LTSS, SLE Micro 5.2 +3 more 5.3.18-150300.59.174.1.150300.18.103.1
- kernel-rt SLE Micro 5.2, SLE Micro 5.1 5.3.18-150300.181.2
suse advisories SUSE-SU-2026:0473-1SUSE-SU-2024:3249-1SUSE-SU-2024:3225-1SUSE-SU-2024:2947-1SUSE-SU-2024:2939-1SUSE-SU-2024:2929-1
- git.kernel.org/stable/c/4325124dde6726267813c736fee61226f1d38f0b commit
- git.kernel.org/stable/c/e2d3a7009e505e120805f449c832942660f3f7f3 commit
- git.kernel.org/stable/c/609a7119bffe3ddd7c93f2fa65be8917e02a0b7e commit
- git.kernel.org/stable/c/2282a6eb6d4e118e294e43dcc421e0e0fe4040b5 commit
- git.kernel.org/stable/c/00bdd9bf1ac6d401ad926d3d8df41b9f1399f646 commit
- git.kernel.org/stable/c/2015c23610cd0efadaeca4d3a8d1dae9a45aa35a commit
- git.kernel.org/stable/c/27d64436984fb8835a8b7e95993193cc478b162e commit
- git.kernel.org/stable/c/16b1941eac2bd499f065a6739a40ce0011a3d740 commit
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2022-48838 updated cvss 5.5
kernel: usb: gadget: Fix use-after-free bug by not setting udc->dev.driver
-
Red Hat Enterprise Linux 6 perf, kernel, python-perf, kernel-kdump, kernel-firmware, kernel-bootwrapper, +1 more Red Hat Enterprise Linux 7 perf, kernel, bpftool, kernel-rt, python-perf, kernel-kdump, +8 more Red Hat Enterprise Linux 8 perf, kernel, bpftool, kernel-rt, kernel-core, kernel-tools, +29 more Red Hat Enterprise Linux 9 rv, perf, rtla, kernel, bpftool, libperf, +83 morenot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- partial
- Assessed
- 2 y ago
Exploit prediction
0.24% chance of exploitation in the next 30 days, higher than 14% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| NVD | 3.1 | 5.5 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
Affected products
- Linux Linux
Classification
- Weakness
-
- CWE-416 Use After Free
- Technology feeds
References
-
git.kernel.org
/stable/c/4325124dde6726267813c736fee61226f1d38f0b
patch
-
git.kernel.org
/stable/c/e2d3a7009e505e120805f449c832942660f3f7f3
patch
-
git.kernel.org
/stable/c/609a7119bffe3ddd7c93f2fa65be8917e02a0b7e
patch
-
git.kernel.org
/stable/c/2282a6eb6d4e118e294e43dcc421e0e0fe4040b5
patch
-
git.kernel.org
/stable/c/00bdd9bf1ac6d401ad926d3d8df41b9f1399f646
patch
-
git.kernel.org
/stable/c/2015c23610cd0efadaeca4d3a8d1dae9a45aa35a
patch
-
git.kernel.org
/stable/c/27d64436984fb8835a8b7e95993193cc478b162e
patch
-
git.kernel.org
/stable/c/16b1941eac2bd499f065a6739a40ce0011a3d740
patch
Sources
- CVE List CVE-2022-48838
- NVD CVE-2022-48838
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.