Skip to contentSkip to conversation

kexec: ensure user memory sizes do not wrap

PATCH New Russell King 1 participant 1 message Jun 3, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 4/8 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.

---
 kernel/kexec_core.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/kexec_core.c +2 -0
index 8d34308ea449..d719a4d0ef55 100644
@@ -169,6 +169,8 @@ int sanity_check_segment_list(struct kimage *image)
 
 		mstart = image->segment[i].mem;
 		mend   = mstart + image->segment[i].memsz;
+		if (mstart > mend)
+			return result;
 		if ((mstart & ~PAGE_MASK) || (mend & ~PAGE_MASK))
 			return result;
 		if (mend >= KEXEC_DESTINATION_MEMORY_LIMIT)
Signature · 1 line
2.1.0