projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
88603b6
)
mtd: parsers: Fix potential memory leak in mtd_parser_tplink_safeloader_parse()
author
Yuan Can
<yuancan@huawei.com>
Thu, 8 Dec 2022 11:36:20 +0000
(11:36 +0000)
committer
Miquel Raynal
<miquel.raynal@bootlin.com>
Mon, 2 Jan 2023 11:08:50 +0000
(12:08 +0100)
The parts needs to be freed with all its elements, otherwise it will be
leaked.
Fixes:
00a3588084be
("mtd: parsers: add TP-Link SafeLoader partitions table parser")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link:
https://lore.kernel.org/linux-mtd/20221208113620.78855-1-yuancan@huawei.com
drivers/mtd/parsers/tplink_safeloader.c
patch
|
blob
|
history
diff --git
a/drivers/mtd/parsers/tplink_safeloader.c
b/drivers/mtd/parsers/tplink_safeloader.c
index
f601e7b
..
1c689da
100644
(file)
--- a/
drivers/mtd/parsers/tplink_safeloader.c
+++ b/
drivers/mtd/parsers/tplink_safeloader.c
@@
-91,7
+91,7
@@
static int mtd_parser_tplink_safeloader_parse(struct mtd_info *mtd,
buf = mtd_parser_tplink_safeloader_read_table(mtd);
if (!buf) {
err = -ENOENT;
- goto err_
out
;
+ goto err_
free_parts
;
}
for (idx = 0, offset = TPLINK_SAFELOADER_DATA_OFFSET;
@@
-118,6
+118,8
@@
static int mtd_parser_tplink_safeloader_parse(struct mtd_info *mtd,
err_free:
for (idx -= 1; idx >= 0; idx--)
kfree(parts[idx].name);
+err_free_parts:
+ kfree(parts);
err_out:
return err;
};