linux/drivers/memory/tegra
Joe Hattori c144423cb0 memory: tegra20-emc: fix an OF node reference bug in tegra_emc_find_node_by_ram_code()
[ Upstream commit b9784e5cde ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-02-08 09:52:14 +01:00
..
Kconfig memory: tegra30-emc: Print additional memory info 2022-01-27 10:40:34 +01:00
Makefile memory: tegra: Add Tegra234 support 2022-05-09 10:46:00 +02:00
mc.c memory: Explicitly include correct DT includes 2023-07-25 22:09:37 +02:00
mc.h memory: tegra: Make CPU cluster BW request a multiple of MC channels 2023-05-16 12:11:01 +02:00
tegra20-emc.c memory: tegra20-emc: fix an OF node reference bug in tegra_emc_find_node_by_ram_code() 2025-02-08 09:52:14 +01:00
tegra20.c memory: Explicitly include correct DT includes 2023-07-25 22:09:37 +02:00
tegra30-emc.c memory: Explicitly include correct DT includes 2023-07-25 22:09:37 +02:00
tegra30.c memory: Explicitly include correct DT includes 2023-07-25 22:09:37 +02:00
tegra114.c memory: tegra: Extract setup code into callback 2021-06-03 21:49:41 +02:00
tegra124-emc.c memory: tegra124-emc: fix interconnect registration race 2023-03-13 21:13:48 +02:00
tegra124.c memory: Explicitly include correct DT includes 2023-07-25 22:09:37 +02:00
tegra186-emc.c memory: tegra186-emc: drop unused to_tegra186_emc() 2024-10-10 11:57:44 +02:00
tegra186.c memory: tegra: Skip SID programming if SID registers aren't set 2024-08-29 17:33:30 +02:00
tegra194.c memory: tegra: Add dummy implementation on Tegra194 2023-07-10 12:04:56 +02:00
tegra210-emc-cc-r21021.c memory: tegra: read values from correct device 2023-04-10 18:55:55 +02:00
tegra210-emc-core.c memory: Explicitly include correct DT includes 2023-07-25 22:09:37 +02:00
tegra210-emc-table.c memory: tegra: remove redundant variable initialization 2023-03-22 18:48:46 +01:00
tegra210-emc.h memory: tegra: Drop <linux/clk-provider.h> 2020-06-22 13:54:58 +02:00
tegra210-mc.h memory: tegra: Add EMC scaling support code for Tegra210 2020-06-22 13:54:57 +02:00
tegra210.c memory: tegra: Extract setup code into callback 2021-06-03 21:49:41 +02:00
tegra234.c memory: tegra: Correct DLA client names 2024-03-26 18:19:32 -04:00