From 70faa195d4e1b6cddcc5c88987be1273eb8cab24 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 4 Jan 2004 17:41:13 -0800 Subject: [PATCH] Don't allow mremap of zero-sized areas. --- mm/mremap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/mremap.c b/mm/mremap.c index 0412a204cb691..ce523ef855556 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -315,6 +315,10 @@ unsigned long do_mremap(unsigned long addr, old_len = PAGE_ALIGN(old_len); new_len = PAGE_ALIGN(new_len); + /* Don't allow the degenerate cases */ + if (!(old_len | new_len)) + goto out; + /* new_addr is only valid if MREMAP_FIXED is specified */ if (flags & MREMAP_FIXED) { if (new_addr & ~PAGE_MASK) -- 2.53.0