]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pstore/platform: Add check for kstrdup
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Fri, 23 Jun 2023 02:27:06 +0000 (10:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:08:13 +0000 (11:08 +0100)
commit379b120e4f27fd1cf636a5f85570c4d240a3f688
tree679ff57b169fd157d9a2613b159d86b8887c80d8
parent81b8638e4ef4632f26b18a21e5d4d06fc5d1aac2
pstore/platform: Add check for kstrdup

[ Upstream commit a19d48f7c5d57c0f0405a7d4334d1d38fe9d3c1c ]

Add check for the return value of kstrdup() and return the error
if it fails in order to avoid NULL pointer dereference.

Fixes: 563ca40ddf40 ("pstore/platform: Switch pstore_info::name to const")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20230623022706.32125-1-jiasheng@iscas.ac.cn
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/pstore/platform.c