Skip to content

Commit 0886bb1

Browse files
XidianGeneralgregkh
authored andcommitted
kernel: kexec_file: fix error return code of kexec_calculate_store_digests()
[ Upstream commit 31d82c2 ] When vzalloc() returns NULL to sha_regions, no error return code of kexec_calculate_store_digests() is assigned. To fix this bug, ret is assigned with -ENOMEM in this case. Link: https://lkml.kernel.org/r/20210309083904.24321-1-baijiaju1990@gmail.com Fixes: a43cac0 ("kexec: split kexec_file syscall code to kexec_file.c") Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Acked-by: Baoquan He <bhe@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d43be02 commit 0886bb1

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎kernel/kexec_file.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,10 @@ static int kexec_calculate_store_digests(struct kimage *image)
740740

741741
sha_region_sz = KEXEC_SEGMENT_MAX * sizeof(struct kexec_sha_region);
742742
sha_regions = vzalloc(sha_region_sz);
743-
if (!sha_regions)
743+
if (!sha_regions) {
744+
ret = -ENOMEM;
744745
goto out_free_desc;
746+
}
745747

746748
desc->tfm = tfm;
747749

0 commit comments

Comments
 (0)