linux-stable/drivers/nvmem
Gaosheng Cui 2bd2774df0 nvmem: core: Fix memleak in nvmem_register()
commit bd1244561f upstream.

dev_set_name will alloc memory for nvmem->dev.kobj.name in
nvmem_register, when nvmem_validate_keepouts failed, nvmem's
memory will be freed and return, but nobody will free memory
for nvmem->dev.kobj.name, there will be memleak, so moving
nvmem_validate_keepouts() after device_register() and let
the device core deal with cleaning name in error cases.

Fixes: de0534df93 ("nvmem: core: fix error handling while validating keepout regions")
Cc: stable@vger.kernel.org
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916120402.38753-1-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-24 09:56:46 +02:00
..
Kconfig nvmem: sfp: Use regmap 2022-05-09 15:46:29 +02:00
Makefile nvmem: Add Apple eFuse driver 2022-05-09 15:44:21 +02:00
apple-efuses.c nvmem: Add Apple eFuse driver 2022-05-09 15:44:21 +02:00
bcm-ocotp.c nvmem: bcm-ocotp: mark ACPI device ID table as maybe unused 2022-04-24 17:15:14 +02:00
brcm_nvram.c nvmem: brcm_nvram: find Device Tree nodes for NVMEM cells 2022-05-09 15:44:21 +02:00
core.c nvmem: core: Fix memleak in nvmem_register() 2022-10-24 09:56:46 +02:00
imx-iim.c nvmem: imx-iim: Use of_device_get_match_data() 2021-02-04 17:04:18 +01:00
imx-ocotp-scu.c
imx-ocotp.c nvmem: imx-ocotp: add support for post processing 2021-10-13 15:33:17 +02:00
jz4780-efuse.c
layerscape-sfp.c nvmem: sfp: Add support for TA 2.1 devices 2022-05-09 15:46:29 +02:00
lpc18xx_eeprom.c
lpc18xx_otp.c
meson-efuse.c
meson-mx-efuse.c nvmem: meson-mx-efuse: replace unnecessary devm_kstrdup() 2022-02-21 18:00:30 +01:00
mtk-efuse.c nvmem: mtk-efuse: support minimum one byte access stride and granularity 2021-12-21 10:26:50 +01:00
mxs-ocotp.c
nintendo-otp.c nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP 2021-08-13 10:27:20 +02:00
qcom-spmi-sdam.c nvmem: convert comma to semicolon 2021-04-02 16:26:33 +02:00
qfprom.c nvmem: qfprom: using pm_runtime_resume_and_get instead of pm_runtime_get_sync 2022-05-09 15:45:39 +02:00
rave-sp-eeprom.c
rmem.c nvmem: Add driver to expose reserved memory as nvmem 2021-02-04 17:04:18 +01:00
rockchip-efuse.c
rockchip-otp.c
sc27xx-efuse.c nvmem: sc27xx: add sc2730 efuse support 2020-07-29 17:12:08 +02:00
snvs_lpgpr.c nvmem: convert comma to semicolon 2021-04-02 16:26:33 +02:00
sprd-efuse.c nvmem: sprd: Fix an error message 2021-05-14 13:39:50 +02:00
stm32-romem.c
sunplus-ocotp.c nvmem: sunplus-ocotp: drop useless probe confirmation 2022-04-24 17:15:15 +02:00
sunxi_sid.c nvmem: sunxi_sid: Add support for D1 variant 2022-02-21 18:00:30 +01:00
uniphier-efuse.c
vf610-ocotp.c
zynqmp_nvmem.c