diff options
| author | Vadym Kochan <[email protected]> | 2020-09-23 20:44:56 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2020-09-27 12:25:48 +0000 |
| commit | fc9eec4d643597cf4cb2fef17d48110e677610da (patch) | |
| tree | 1fd23e86d6682d06b3720a601d835f7d4c76651d /drivers/hwtracing/coresight/coresight-cpu-debug.c | |
| parent | slimbus: qcom-ngd-ctrl: disable ngd in qmi server down callback (diff) | |
| download | kernel-fc9eec4d643597cf4cb2fef17d48110e677610da.tar.gz kernel-fc9eec4d643597cf4cb2fef17d48110e677610da.zip | |
nvmem: core: fix possibly memleak when use nvmem_cell_info_to_nvmem_cell()
Fix missing 'kfree_const(cell->name)' when call to
nvmem_cell_info_to_nvmem_cell() in several places:
* after nvmem_cell_info_to_nvmem_cell() failed during
nvmem_add_cells()
* during nvmem_device_cell_{read,write} when cell->name is
kstrdup'ed() without calling kfree_const() at the end, but
really there is no reason to do that 'dup, because the cell
instance is allocated on the stack for some short period to be
read/write without exposing it to the caller.
So the new nvmem_cell_info_to_nvmem_cell_nodup() helper is introduced
which is used to convert cell_info -> cell without name duplication as
a lighweight version of nvmem_cell_info_to_nvmem_cell().
Fixes: e2a5402ec7c6 ("nvmem: Add nvmem_device based consumer apis.")
Reviewed-by: Srinivas Kandagatla <[email protected]>
Acked-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Vadym Kochan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/hwtracing/coresight/coresight-cpu-debug.c')
0 files changed, 0 insertions, 0 deletions
