diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-01-29 20:14:26 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-04 13:38:14 +0300 |
commit | 0422b93c4bfb2a4d2cd5402f95591cc323fe577c (patch) | |
tree | 7029685ddbfbd755b3d0bb3048829da08f2eb7b4 | |
parent | 5678109857cdf82c21eccf741a60ff7b46419f13 (diff) | |
download | linux-0422b93c4bfb2a4d2cd5402f95591cc323fe577c.tar.xz |
nvmem: core: Fix a resource leak on error in nvmem_add_cells_from_of()
[ Upstream commit 72e008ce307fa2f35f6783997378b32e83122839 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/nvmem/core.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index a09ff8409f60..1a3460a8e73a 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -576,6 +576,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; } |