CVE-2022-50304
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
15/09/2025
Last modified:
15/09/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
mtd: core: fix possible resource leak in init_mtd()<br />
<br />
I got the error report while inject fault in init_mtd():<br />
<br />
sysfs: cannot create duplicate filename &#39;/devices/virtual/bdi/mtd-0&#39;<br />
Call Trace:<br />
<br />
dump_stack_lvl+0x67/0x83<br />
sysfs_warn_dup+0x60/0x70<br />
sysfs_create_dir_ns+0x109/0x120<br />
kobject_add_internal+0xce/0x2f0<br />
kobject_add+0x98/0x110<br />
device_add+0x179/0xc00<br />
device_create_groups_vargs+0xf4/0x100<br />
device_create+0x7b/0xb0<br />
bdi_register_va.part.13+0x58/0x2d0<br />
bdi_register+0x9b/0xb0<br />
init_mtd+0x62/0x171 [mtd]<br />
do_one_initcall+0x6c/0x3c0<br />
do_init_module+0x58/0x222<br />
load_module+0x268e/0x27d0<br />
__do_sys_finit_module+0xd5/0x140<br />
do_syscall_64+0x37/0x90<br />
entry_SYSCALL_64_after_hwframe+0x63/0xcd<br />
<br />
kobject_add_internal failed for mtd-0 with -EEXIST, don&#39;t try to register<br />
things with the same name in the same directory.<br />
Error registering mtd class or bdi: -17<br />
<br />
If init_mtdchar() fails in init_mtd(), mtd_bdi will not be unregistered,<br />
as a result, we can&#39;t load the mtd module again, to fix this by calling<br />
bdi_unregister(mtd_bdi) after out_procfs label.