Skip to content

[PW_SID:1102599] riscv: Fix a NULL pointer reference in machine_kexec_prepare#2032

Open
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1102599
Open

[PW_SID:1102599] riscv: Fix a NULL pointer reference in machine_kexec_prepare#2032
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1102599

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1102599 applied to workflow__riscv__fixes

Name: riscv: Fix a NULL pointer reference in machine_kexec_prepare
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1102599
Version: 1

A NULL pointer reference issue is noticed in riscv's machine_kexec_prepare,
where image->segment[i].buf might be NULL and copied unchecked.

The NULL buf comes from security/integrity/ima/ima_kexec.c:
ima_add_kexec_buffer(), where kbuf is added by kexec_add_buffer(),
but kbuf.buffer is NULL.

Fix this by simply adding a check before copy.

Signed-off-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 138.63 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1135.81 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1693.71 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.60 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.97 seconds
Result: WARNING
Output:

CHECK: Comparison to NULL could be written "!image->segment[i].buf"
#29: FILE: arch/riscv/kernel/machine_kexec.c:44:
+		if (image->segment[i].buf == NULL)

total: 0 errors, 0 warnings, 1 checks, 9 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 1e32933a5692 ("riscv: Fix a NULL pointer reference in machine_kexec_prepare") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 1 checks, 9 lines checked
CHECK: Comparison to NULL could be written "!image->segment[i].buf"


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.67 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
kdoc
Desc: Detects for kdoc errors
Duration: 0.88 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "riscv: Fix a NULL pointer reference in machine_kexec_prepare"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants