diff options
author | Yao Zi <ziyao@disroot.org> | 2025-08-03 22:49:47 +0800 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2025-08-03 22:49:47 +0800 |
commit | 70a2365e18affc5ebdaab1ca6a0b3c4f3aac2ee8 (patch) | |
tree | 36ea132d6cb67d206ef07c950bc4790449506246 /drivers/pwm/pwm-stm32.c | |
parent | 243f8de49f076d56ee88d6f03b6221984cc63668 (diff) |
LoongArch: Avoid in-place string operation on FDT content
In init_cpu_fullname(), a constant pointer to "model" property is
retrieved. It's later modified by the strsep() function, which is
illegal and corrupts kernel's FDT copy. This is shown by dmesg,
OF: fdt: not creating '/sys/firmware/fdt': CRC check failed
Create a mutable copy of the model property and do in-place operations
on the mutable copy instead. loongson_sysconf.cpuname lives across the
kernel lifetime, thus manually releasing isn't necessary.
Also move the of_node_put() call for the root node after the usage of
its property, since of_node_put() decreases the reference counter thus
usage after the call is unsafe.
Cc: stable@vger.kernel.org
Fixes: 44a01f1f726a ("LoongArch: Parsing CPU-related information from DTS")
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Yao Zi <ziyao@disroot.org>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'drivers/pwm/pwm-stm32.c')
0 files changed, 0 insertions, 0 deletions