linux/drivers/memory
Joe Hattori b9784e5cde memory: tegra20-emc: fix an OF node reference bug in tegra_emc_find_node_by_ram_code()
As of_find_node_by_name() release the reference of the argument device
node, tegra_emc_find_node_by_ram_code() releases some device nodes while
still in use, resulting in possible UAFs. According to the bindings and
the in-tree DTS files, the "emc-tables" node is always device's child
node with the property "nvidia,use-ram-code", and the "lpddr2" node is a
child of the "emc-tables" node. Thus utilize the
for_each_child_of_node() macro and of_get_child_by_name() instead of
of_find_node_by_name() to simplify the code.

This bug was found by an experimental verification tool that I am
developing.

Fixes: 96e5da7c84 ("memory: tegra: Introduce Tegra20 EMC driver")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20241217091434.1993597-1-joe@pf.is.s.u-tokyo.ac.jp
Link: https://lore.kernel.org/r/20241218024415.2494267-3-joe@pf.is.s.u-tokyo.ac.jp
[krzysztof: applied v1, adjust the commit msg to incorporate v2 parts]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-12-22 11:02:39 +01:00
..
samsung memory: samsung: exynos5422-dmc: use scoped device node handling to simplify error paths 2024-08-21 13:23:33 +02:00
tegra memory: tegra20-emc: fix an OF node reference bug in tegra_emc_find_node_by_ram_code() 2024-12-22 11:02:39 +01:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
atmel-ebi.c memory: atmel-ebi: simplify with scoped for each OF child loop 2024-08-21 13:23:32 +02:00
brcmstb_dpfe.c memory: brcmstb_dpfe: Convert to platform remove callback returning void 2023-12-19 09:05:15 +01:00
brcmstb_memc.c memory: brcmstb_memc: fix module autoloading 2024-04-11 08:21:49 +02:00
bt1-l2-ctl.c memory: remove MODULE_LICENSE in non-modules 2023-03-09 15:20:50 +01:00
da8xx-ddrctl.c memory: Explicitly include correct DT includes 2023-07-25 22:09:37 +02:00
dfl-emif.c memory: dfl-emif: Update the dfl emif driver support revision 1 2022-08-16 12:12:04 +03:00
emif-asm-offsets.c memory: emif-asm-offsets: Add GPLv2 SPDX license header 2020-07-24 16:18:32 +02:00
emif.c memory: emif: simplify locking with guard() 2024-08-25 11:02:15 +02:00
emif.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
fsl-corenet-cf.c memory: fsl-corenet-cf: Convert to platform remove callback returning void 2023-12-19 09:05:16 +01:00
fsl_ifc.c memory: fsl_ifc: Convert to platform remove callback returning void 2023-12-19 09:05:16 +01:00
jedec_ddr.h memory: Add LPDDR2-info helpers 2021-10-15 09:52:47 +02:00
jedec_ddr_data.c memory: Add LPDDR2-info helpers 2021-10-15 09:52:47 +02:00
jz4780-nemc.c memory: jz4780-nemc: Convert to platform remove callback returning void 2023-12-19 09:05:16 +01:00
Kconfig memory: fsl_ifc: Make FSL_IFC config visible and selectable 2024-06-12 10:17:37 +02:00
Makefile memory: atmel-sdramc: remove the driver 2023-06-02 10:39:24 +02:00
mtk-smi.c memory: mtk-smi: Use devm_clk_get_enabled() 2024-08-25 11:02:17 +02:00
mvebu-devbus.c memory: remove MODULE_LICENSE in non-modules 2023-03-09 15:20:50 +01:00
of_memory.c memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() 2022-08-16 12:12:06 +03:00
of_memory.h memory: Add LPDDR2-info helpers 2021-10-15 09:52:47 +02:00
omap-gpmc.c memory: omap-gpmc: deadcode a pair of functions 2024-12-14 11:41:05 +01:00
pl172.c memory: pl172: simplify releasing AMBA regions with devm 2024-08-31 07:44:23 +02:00
pl353-smc.c memory: pl353-smc: simplify with scoped for each OF child loop 2024-08-31 07:44:24 +02:00
renesas-rpc-if.c memory: renesas-rpc-if: Use Hi-Z state as the default setting for IOVF pins 2024-08-31 07:30:32 +02:00
stm32-fmc2-ebi.c memory: stm32-fmc2-ebi: simplify with dev_err_probe() 2024-08-21 13:23:33 +02:00
ti-aemif.c memory: ti-aemif: Revert "memory: ti-aemif: don't needlessly iterate over child nodes" 2024-08-25 10:24:23 +02:00
ti-emif-pm.c memory: ti-emif-pm: Convert to platform remove callback returning void 2023-12-19 09:05:19 +01:00
ti-emif-sram-pm.S ARM: mm: Make virt_to_pfn() a static inline 2023-05-29 11:27:08 +02:00