[PATCH 8/8] memory: emif: Clear invalid custom_configs in get_device_details()
From: Lee Jones
Date: Wed Dec 02 2026 - 04:36:10 EST
get_device_details() copies the entire platform_data structure,
including its custom_configs pointer, into a devm-allocated copy. If
is_custom_config_valid() rejects the platform data's custom_configs,
the pointer is never cleared and subsequent driver paths continue to
dereference the invalid configuration.
Reset pd->custom_configs to NULL before validating and copying
cust_cfgs.
Fixes: 7ec944538dde ("memory: emif: add basic infrastructure for EMIF driver")
Closes: https://sashiko.dev/#/bug/linux-aae546d8-c18b-4dce-8ffd-052d75f04a47
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/memory/emif.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c
index cb2c49028d6c..6d5a74a0ab8b 100644
--- a/drivers/memory/emif.c
+++ b/drivers/memory/emif.c
@@ -1040,6 +1040,7 @@ static struct emif_data *get_device_details(
* custom_configs is not very critical
*/
cust_cfgs = pd->custom_configs;
+ pd->custom_configs = NULL;
if (cust_cfgs && is_custom_config_valid(cust_cfgs, dev)) {
temp = devm_kzalloc(dev, sizeof(*cust_cfgs), GFP_KERNEL);
if (temp)
--
2.56.1.911.g883d8bcb20-goog