mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-15 11:44:11 +00:00
pstore/ram: Add check for kstrdup
[ Upstream commitd97038d5ec
] Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference. Fixes:e163fdb3f7
("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>
This commit is contained in:
parent
ce68f858c5
commit
4b89c87407
1 changed files with 2 additions and 0 deletions
|
@ -591,6 +591,8 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
|
|||
raw_spin_lock_init(&prz->buffer_lock);
|
||||
prz->flags = flags;
|
||||
prz->label = kstrdup(label, GFP_KERNEL);
|
||||
if (!prz->label)
|
||||
goto err;
|
||||
|
||||
ret = persistent_ram_buffer_map(start, size, prz, memtype);
|
||||
if (ret)
|
||||
|
|
Loading…
Add table
Reference in a new issue