pstore/ram: Add check for kstrdup
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Wed, 14 Jun 2023 09:37:33 +0000 (17:37 +0800)
committerKees Cook <keescook@chromium.org>
Wed, 14 Jun 2023 18:52:10 +0000 (11:52 -0700)
commitd97038d5ec2062733c1e016caf9baaf68cf64ea1
tree89c696e7b4c68787c04d1dd11dad059e358f588c
parent48f2c681df4329b50fc92516c10e0398ca127242
pstore/ram: Add check for kstrdup

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
fs/pstore/ram_core.c