kexec: ensure user memory sizes do not wrap
[email protected]
maintainerPATCH 79/111 kexec: ensure user memory sizes do not wrap
From: Russell King <[email protected]>
Subject: kexec: ensure user memory sizes do not wrap
Ensure that user memory sizes do not wrap around when validating the user input, which can lead to the following input validation working incorrectly.
[[email protected]: fix it for kexec-return-error-number-directly.patch]
Signed-off-by Russell King <[email protected]>
Reviewed-by Pratyush Anand <[email protected]>
Acked-by Baoquan He <[email protected]>
Cc Keerthy <[email protected]>
Cc Vitaly Andrianov <[email protected]>
Cc Eric Biederman <[email protected]>
Cc Dave Young <[email protected]>
Cc Vivek Goyal <[email protected]>
Cc Simon Horman <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
kernel/kexec_core.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/kexec_core.c renamed from kernel/kexec_core.c~kexec-ensure-user-memory-sizes-do-not-wrap +2 -0
@@ -168,6 +168,8 @@ int sanity_check_segment_list(struct kim mstart = image->segment[i].mem; mend = mstart + image->segment[i].memsz; +if (mstart > mend) +return -EADDRNOTAVAIL ;if ((mstart & ~PAGE_MASK ) || (mend & ~PAGE_MASK ))return -EADDRNOTAVAIL ;if (mend >=KEXEC_DESTINATION_MEMORY_LIMIT )
_