[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240225060450.53044-1-duoming@zju.edu.cn>
Date: Sun, 25 Feb 2024 14:04:50 +0800
From: Duoming Zhou <duoming@....edu.cn>
To: linux-arm-kernel@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org,
andrew@...n.ch,
gregory.clement@...tlin.com,
sebastian.hesselbarth@...il.com,
linux@...linux.org.uk,
Duoming Zhou <duoming@....edu.cn>
Subject: [PATCH] ARM: mvebu: Add check in coherency.c to prevent null pointer dereference
The kzalloc() in armada_375_380_coherency_init() will return
null if the physical memory has run out. As a result, if we
dereference the property pointer, the null pointer dereference
bug will happen.
This patch adds a check to avoid null pointer dereference.
Fixes: 497a92308af8 ("ARM: mvebu: implement L2/PCIe deadlock workaround")
Signed-off-by: Duoming Zhou <duoming@....edu.cn>
---
arch/arm/mach-mvebu/coherency.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index a6b621ff0b8..a81a3c8c19a 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -191,6 +191,8 @@ static void __init armada_375_380_coherency_init(struct device_node *np)
struct property *p;
p = kzalloc(sizeof(*p), GFP_KERNEL);
+ if (!p)
+ continue;
p->name = kstrdup("arm,io-coherent", GFP_KERNEL);
of_add_property(cache_dn, p);
}
--
2.17.1
Powered by blists - more mailing lists