From: Naoya Horiguchi Date: Tue, 15 Mar 2016 21:56:36 +0000 (-0700) Subject: mm/madvise: pass return code of memory_failure() to userspace X-Git-Tag: MMI-PSA29.97-13-9~8344^2~44 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=23a003bfd23ea9ea0b7756b920e51f64b284b468;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git mm/madvise: pass return code of memory_failure() to userspace Currently the return value of memory_failure() is not passed to userspace when madvise(MADV_HWPOISON) is used. This is inconvenient for test programs that want to know the result of error handling. So let's return it to the caller as we already do in the MADV_SOFT_OFFLINE case. Signed-off-by: Naoya Horiguchi Cc: Chen Gong Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/madvise.c b/mm/madvise.c index f56825b6d2e1..6a7711436c5b 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -555,8 +555,9 @@ static int madvise_hwpoison(int bhv, unsigned long start, unsigned long end) } pr_info("Injecting memory failure for page %#lx at %#lx\n", page_to_pfn(p), start); - /* Ignore return value for now */ - memory_failure(page_to_pfn(p), 0, MF_COUNT_INCREASED); + ret = memory_failure(page_to_pfn(p), 0, MF_COUNT_INCREASED); + if (ret) + return ret; } return 0; }