]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pstore/ram: Add check for kstrdup
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Wed, 14 Jun 2023 09:37:33 +0000 (17:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jul 2023 17:39:26 +0000 (19:39 +0200)
commit2a764a2facd9dd88a69777200f65dfd0182765dc
tree6e3696e45eb3a41be8afdc6b8ecca4333d5544c7
parentd1225affc6cdb08e99f77e9e26c0aeb035a91af3
pstore/ram: Add check for kstrdup

[ Upstream commit d97038d5ec2062733c1e016caf9baaf68cf64ea1 ]

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

Fixes: e163fdb3f7f8 ("pstore/ram: Regularize prz label allocation lifetime")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230614093733.36048-1-jiasheng@iscas.ac.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/pstore/ram_core.c