milos-linux/drivers/nvmem
Bartosz Golaszewski 5b6b6fc491 nvmem: core: fix use-after-free bugs in error paths
Fix several instances of error paths in which we call
__nvmem_device_put() - which may end up freeing the underlying memory
and other resources - and then keep on using the nvmem structure. Always
put the reference to the nvmem device as the last step before returning
the error code.

Cc: stable@vger.kernel.org
Fixes: 7ae6478b30 ("nvmem: core: rework nvmem cell instance creation")
Fixes: e888d445ac ("nvmem: resolve cells from DT at registration time")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
Link: https://patch.msgid.link/20260530204340.116743-3-srini@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-06-05 17:18:58 +02:00
..
layouts nvmem: layouts: onie-tlv: fix hang on unknown types 2026-06-05 17:18:58 +02:00
an8855-efuse.c nvmem: an8855: Add support for Airoha AN8855 Switch EFUSE 2025-09-12 15:49:03 +02:00
apple-efuses.c
apple-spmi-nvmem.c nvmem: Add apple-spmi-nvmem driver 2025-05-21 14:28:27 +02:00
bcm-ocotp.c
brcm_nvram.c kernel.h: drop hex.h and update all hex.h users 2026-01-20 19:44:19 -08:00
core.c nvmem: core: fix use-after-free bugs in error paths 2026-06-05 17:18:58 +02:00
imx-iim.c
imx-ocotp-ele.c nvmem: imx: assign nvmem_cell_info::raw_len 2026-04-02 16:44:40 +02:00
imx-ocotp-scu.c
imx-ocotp.c nvmem: imx: assign nvmem_cell_info::raw_len 2026-04-02 16:44:40 +02:00
internals.h
jz4780-efuse.c
Kconfig nvmem: an8855: drop an unused Kconfig symbol 2026-01-26 16:40:33 +01:00
lan9662-otpc.c
layerscape-sfp.c
layouts.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
lpc18xx_eeprom.c
lpc18xx_otp.c
Makefile nvmem: Add driver for the eeprom in qnap-mcu controllers 2025-11-24 18:06:22 +01:00
max77759-nvmem.c
meson-efuse.c
meson-mx-efuse.c
microchip-otpc.c
mtk-efuse.c
mxs-ocotp.c
nintendo-otp.c
qcom-spmi-sdam.c
qfprom.c
qnap-mcu-eeprom.c nvmem: qnap-mcu-eeprom: Fix struct assignments using commas instead of semicolons 2026-04-02 16:15:56 +02:00
qoriq-efuse.c
rave-sp-eeprom.c
rcar-efuse.c nvmem: rcar-efuse: add missing MODULE_DEVICE_TABLE 2025-10-22 08:02:38 +02:00
rmem.c
rockchip-efuse.c
rockchip-otp.c nvmem: rockchip-otp: Add support for RK3528 2026-04-02 16:15:56 +02:00
s32g-ocotp-nvmem.c nvmem: s32g-ocotp: Add driver for S32G OCOTP 2025-09-12 15:49:03 +02:00
sc27xx-efuse.c
sec-qfprom.c
snvs_lpgpr.c
sprd-efuse.c
stm32-bsec-optee-ta.c
stm32-bsec-optee-ta.h
stm32-romem.c
sunplus-ocotp.c
sunxi_sid.c
u-boot-env.c
uniphier-efuse.c
vf610-ocotp.c
zynqmp_nvmem.c nvmem: zynqmp_nvmem: Fix buffer size in DMA and memcpy 2026-04-02 16:44:40 +02:00