1
0
Fork 0
alistair23-linux/drivers/nvmem
Vadym Kochan 99e8886339 nvmem: core: fix possibly memleak when use nvmem_cell_info_to_nvmem_cell()
[ Upstream commit fc9eec4d64 ]

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: e2a5402ec7 ("nvmem: Add nvmem_device based consumer apis.")
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Vadym Kochan <vadym.kochan@plvision.eu>
Link: https://lore.kernel.org/r/20200923204456.14032-1-vadym.kochan@plvision.eu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-29 09:57:42 +01:00
..
Kconfig nvmem: Broaden the selection of NVMEM_SNVS_LPGPR 2019-06-19 19:35:51 +02:00
Makefile nvmem: imx: add i.MX8 nvmem driver 2019-06-19 19:35:51 +02:00
bcm-ocotp.c nvmem: bcm-ocotp: Add ACPI support to BCM OCOTP 2019-01-31 16:24:14 +01:00
core.c nvmem: core: fix possibly memleak when use nvmem_cell_info_to_nvmem_cell() 2020-10-29 09:57:42 +01:00
imx-iim.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 460 2019-06-19 17:09:09 +02:00
imx-ocotp-scu.c nvmem: imx: add i.MX8QM platform support 2019-08-18 12:56:53 +02:00
imx-ocotp.c nvmem: imx-ocotp: reset error status on probe 2019-12-31 16:44:42 +01:00
lpc18xx_eeprom.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lpc18xx_otp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
meson-efuse.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295 2019-06-05 17:36:38 +02:00
meson-mx-efuse.c nvmem: meson-mx-efuse: allow reading data smaller than word_size 2019-08-18 12:56:52 +02:00
mtk-efuse.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
mxs-ocotp.c nvmem: mxs-ocotp: update MODULE_AUTHOR() email address 2019-08-18 12:56:52 +02:00
nvmem-sysfs.c nvmem: check for NULL reg_read and reg_write before dereferencing 2020-04-08 09:08:42 +02:00
nvmem.h nvmem: core: add NVMEM_SYSFS Kconfig 2019-04-25 19:44:33 +02:00
qfprom.c nvmem: qfprom: remove incorrect write support 2020-06-10 20:24:57 +02:00
rave-sp-eeprom.c nvmem: rave-sp-eeprom: Remove VLA usage 2018-07-07 17:30:46 +02:00
rockchip-efuse.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295 2019-06-05 17:36:38 +02:00
sc27xx-efuse.c nvmem: sc27xx: Convert nvmem offset to block index 2019-01-31 16:24:14 +01:00
snvs_lpgpr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
stm32-romem.c nvmem: stm32: add support for STM32MP15 BSEC to control OTP data 2019-04-25 19:43:12 +02:00
sunxi_sid.c nvmem: sunxi_sid: fix A64 SID controller support 2019-08-18 12:56:52 +02:00
uniphier-efuse.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
vf610-ocotp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
zynqmp_nvmem.c drivers: Defer probe if firmware is not ready 2019-03-18 13:45:27 +01:00