mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
mtd: virt-concat: free duplicate generated name
Every MTD registration runs mtd_virt_concat_create_join(). Once a
virtual concat has already been registered, the function builds the same
name again and takes the equal-name branch. That branch skips to the
next item without freeing the newly allocated string.
Free the temporary name before continuing.
Fixes: 43db6366fc ("mtd: Add driver for concatenating devices")
Cc: stable@vger.kernel.org
Signed-off-by: Xu Rao <raoxu@uniontech.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
parent
16f7ec8d5d
commit
caa0ecbeff
|
|
@ -321,8 +321,10 @@ int mtd_virt_concat_create_join(void)
|
|||
|
||||
if (concat->mtd.name) {
|
||||
ret = memcmp(concat->mtd.name, name, name_sz);
|
||||
if (ret == 0)
|
||||
if (ret == 0) {
|
||||
kfree(name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
mtd = mtd_concat_create(concat->subdev, concat->num_subdev, name);
|
||||
if (!mtd) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user