mtd: parsers: Fix memory leak in mtd_parser_tplink_safeloader_parse()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
mtd: parsers: Fix memory leak in mtd_parser_tplink_safeloader_parse()
The function mtd_parser_tplink_safeloader_parse() allocates buf via mtd_parser_tplink_safeloader_read_table(). If the allocation for parts[idx].name fails inside the loop, the code jumps to the err_free label without freeing buf, leading to a memory leak.
Fix this by freeing the temporary buffer buf in the err_free label.
Compile tested only. Issue found using a prototype static analysis tool and code review.
From the CVE record · Linux
The Linux kernel's TP-Link safeloader MTD parser can leak a temporary buffer if allocation of a partition name fails. The input does not establish whether an attacker can trigger this condition, or specify network access, authentication, or user-interaction requirements.
Engineers running the Linux kernel should check whether their kernel includes the affected MTD parser; affected versions are not specified.