CVE-2022-50304: mtd: core: fix possible resource leak in init_mtd()

Published Sep 15, 2025
·
Updated

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

mtd: core: fix possible resource leak in initmtd()

I got the error report while inject fault in initmtd():

sysfs: cannot create duplicate filename '/devices/virtual/bdi/mtd-0' Call Trace: <TASK> dumpstacklvl+0x67/0x83 sysfswarndup+0x60/0x70 sysfscreatedirns+0x109/0x120 kobjectaddinternal+0xce/0x2f0 kobjectadd+0x98/0x110 deviceadd+0x179/0xc00 devicecreategroupsvargs+0xf4/0x100 devicecreate+0x7b/0xb0 bdiregisterva.part.13+0x58/0x2d0 bdiregister+0x9b/0xb0 initmtd+0x62/0x171 [mtd] dooneinitcall+0x6c/0x3c0 doinitmodule+0x58/0x222 loadmodule+0x268e/0x27d0 dosysfinitmodule+0xd5/0x140 dosyscall64+0x37/0x90 entrySYSCALL64afterhwframe+0x63/0xcd </TASK> kobjectaddinternal failed for mtd-0 with -EEXIST, don't try to register things with the same name in the same directory. Error registering mtd class or bdi: -17

If initmtdchar() fails in initmtd(), mtdbdi will not be unregistered, as a result, we can't load the mtd module again, to fix this by calling bdiunregister(mtdbdi) after outprocfs label.

Affected Software

4 affected components
Linux Foundation Linux Kernel
Linux Linux kernel>=4.10<6.0.16
Linux Linux kernel>=6.1<6.1.2
Microsoft cbl2 kernel 5.15.186.1-1

Event History

Sep 15, 2025
CVE Published
via MITRE·02:45 PM
Data Sourced
via MITRE·02:45 PM
Description
Data Sourced
via NVD·03:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Dec 6, 2025
Data Sourced
via Microsoft·01:01 AM
DescriptionSeverityWeaknessAffected Software
Updated
via Microsoft·01:01 AM
DescriptionSeverity

Frequently Asked Questions

1

What is the severity of CVE-2022-50304?

CVE-2022-50304 has a medium severity rating due to the potential for resource leaks in the Linux kernel.

2

How do I fix CVE-2022-50304?

To fix CVE-2022-50304, ensure that you update to the latest version of the Linux kernel where the vulnerability has been addressed.

3

What is the nature of the vulnerability in CVE-2022-50304?

CVE-2022-50304 involves a possible resource leak in the init_mtd() function within the Linux kernel.

4

Which versions of the Linux kernel are affected by CVE-2022-50304?

CVE-2022-50304 affects various versions of the Linux kernel prior to the patch that resolves the vulnerability.

5

Can CVE-2022-50304 impact system stability?

Yes, CVE-2022-50304 can potentially impact system stability due to resource leaks in the kernel.

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