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:
76ec1ec
)
nvmem: core: Fix a resource leak on error in nvmem_add_cells_from_of()
author
Dan Carpenter
<dan.carpenter@oracle.com>
Fri, 29 Jan 2021 17:14:26 +0000
(17:14 +0000)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 4 Feb 2021 16:04:18 +0000
(17:04 +0100)
This doesn't call of_node_put() on the error path so it leads to a
memory leak.
Fixes:
0749aa25af82
("nvmem: core: fix regression in of_nvmem_cell_get()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link:
https://lore.kernel.org/r/20210129171430.11328-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/core.c
patch
|
blob
|
history
diff --git
a/drivers/nvmem/core.c
b/drivers/nvmem/core.c
index
177f5bf
..
68ae6f2
100644
(file)
--- a/
drivers/nvmem/core.c
+++ b/
drivers/nvmem/core.c
@@
-713,6
+713,7
@@
static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
cell->name, nvmem->stride);
/* Cells already added will be freed later. */
kfree_const(cell->name);
+ of_node_put(cell->np);
kfree(cell);
return -EINVAL;
}