CVE-2023-54321: driver core: fix potential null-ptr-deref in device_add()

Published Dec 30, 2025
·
Updated

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

driver core: fix potential null-ptr-deref in deviceadd()

I got the following null-ptr-deref report while doing fault injection test:

BUG: kernel NULL pointer dereference, address: 0000000000000058 CPU: 2 PID: 278 Comm: 37-i2c-ds2482 Tainted: G B W N 6.1.0-rc3+ RIP: 0010:klistput+0x2d/0xd0 Call Trace: <TASK> klistremove+0xf1/0x1c0 devicereleasedriverinternal+0x196/0x210 busremovedevice+0x1bd/0x240 deviceadd+0xd3d/0x1100 w1addmasterdevice+0x476/0x490 [wire] ds2482probe+0x303/0x3e0 [ds2482]

This is how it happened:

w1allocdev() // The dev->driver is set to w1masterdriver. memcpy(&dev->dev, device, sizeof(struct device)); deviceadd() busadddevice() dpmsysfsadd() // It fails, calls busremovedevice.

// error path busremovedevice() // The dev->driver is not null, but driver is not bound. devicereleasedriver() klistremove(&dev->p->knodedriver) <-- It causes null-ptr-deref.

// normal path busprobedevice() // It's not called yet. devicebinddriver()

If dev->driver is set, in the error path after calling busadddevice() in deviceadd(), busremovedevice() is called, then the device will be detached from driver. But devicebinddriver() is not called yet, so it causes null-ptr-deref while access the 'knodedriver'. To fix this, set dev->driver to null in the error path before calling busremovedevice().

Affected Software

5 affected components
linux-kernel>6.1.0-rc3
Linux Linux kernel>=2.6.26<5.10.249
Linux Linux kernel>=5.11<5.15.99
Linux Linux kernel>=5.16<6.1.16
Linux Linux kernel>=6.2<6.2.3

Event History

Dec 30, 2025
CVE Published
via MITRE·12:34 PM
Data Sourced
via MITRE·12:34 PM
Description
Data Sourced
via NVD·01:16 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2023-54321?

CVE-2023-54321 has a medium severity due to the potential for a kernel NULL pointer dereference.

2

How do I fix CVE-2023-54321?

To fix CVE-2023-54321, update your Linux kernel to a version later than 6.1.0-rc3 where the vulnerability has been patched.

3

What systems are affected by CVE-2023-54321?

CVE-2023-54321 affects versions of the Linux kernel prior to the patch including 6.1.0-rc3.

4

What is the impact of CVE-2023-54321?

The impact of CVE-2023-54321 could lead to a denial of service due to unexpected kernel crashes.

5

Is there a workaround for CVE-2023-54321?

There is no known workaround for CVE-2023-54321, so applying the kernel update is recommended.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203