Skip to content

Commit

Permalink
kexec: ensure user memory sizes do not wrap
Browse files Browse the repository at this point in the history
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]
Link: http://lkml.kernel.org/r/[email protected]
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]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Russell King authored and torvalds committed Aug 2, 2016
1 parent dc5ccca commit 465d377
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/kexec_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ int sanity_check_segment_list(struct kimage *image)

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)
Expand Down

0 comments on commit 465d377

Please sign in to comment.