
From: Shuai Xue <xueshuai@linux.alibaba.com> maillist inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IB0OV7 CVE: NA Reference: https://lore.kernel.org/lkml/20241202030527.20586-3-xueshuai@linux.alibaba.c... ---------------------------------------------------------------------- Part of return value comments for memory_failure() were originally documented at the call site. Move those comments to the function declaration to improve code readability and to provide developers with immediate access to function usage and return information. Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com> Conflicts: arch/x86/kernel/cpu/mce/core.c mm/memory-failure.c [fix context conflicts and memory_failure() return value] Signed-off-by: Tong Tiangen <tongtiangen@huawei.com> --- arch/x86/kernel/cpu/mce/core.c | 5 ----- mm/memory-failure.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 6cb84c19a3bd..497ff1901d9d 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1276,11 +1276,6 @@ static void kill_me_maybe(struct callback_head *cb) return; } - /* - * -EHWPOISON from memory_failure() means that it already sent SIGBUS - * to the current process with the proper error info, so no need to - * send SIGBUS here again. - */ if (ret == -EHWPOISON) return; diff --git a/mm/memory-failure.c b/mm/memory-failure.c index a5ab0b2f213b..32b26b58e92d 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1524,6 +1524,12 @@ static int memory_failure_dev_pagemap(unsigned long pfn, int flags, * * Must run in process context (e.g. a work queue) with interrupts * enabled and no spinlocks hold. + * Return: + * 0 - success, + * -ENXIO - memory not managed by the kernel + * -EHWPOISON - the page was already poisoned, potentially + * kill process, + * other negative values - failure. */ int memory_failure(unsigned long pfn, int flags) { -- 2.25.1