summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorHeesub Shin <heesub.shin@samsung.com>2013-07-31 13:53:40 -0700
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:47:19 +0900
commitc81b00e74776b98feb94b984b3ea42a2f3d0f3da (patch)
tree4c6140f5bee31f38d18d16c24bf06c11391fe1b5 /mm
parent6e19d46a034c6310385cd60843d83aa74f4402e0 (diff)
downloadlinux-3.10-c81b00e74776b98feb94b984b3ea42a2f3d0f3da.tar.gz
linux-3.10-c81b00e74776b98feb94b984b3ea42a2f3d0f3da.tar.bz2
linux-3.10-c81b00e74776b98feb94b984b3ea42a2f3d0f3da.zip
mm: zbud: fix condition check on allocation size
zbud_alloc() incorrectly verifies the size of allocation limit. It should deny the allocation request greater than (PAGE_SIZE - ZHDR_SIZE_ALIGNED - CHUNK_SIZE), not (PAGE_SIZE - ZHDR_SIZE_ALIGNED) which has no remaining spaces for its buddy. There is no point in spending the entire zbud page storing only a single page, since we don't have any benefits. Change-Id: Ief305088b6983c01426300a0638520f51b17ad2a Signed-off-by: Heesub Shin <heesub.shin@samsung.com> Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com> Cc: Bob Liu <bob.liu@oracle.com> Cc: Dongjun Shin <d.j.shin@samsung.com> Cc: Sunae Seo <sunae.seo@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/zbud.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/zbud.c b/mm/zbud.c
index 9bb4710e358..ad1e781284f 100644
--- a/mm/zbud.c
+++ b/mm/zbud.c
@@ -257,7 +257,7 @@ int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp,
if (size <= 0 || gfp & __GFP_HIGHMEM)
return -EINVAL;
- if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED)
+ if (size > PAGE_SIZE - ZHDR_SIZE_ALIGNED - CHUNK_SIZE)
return -ENOSPC;
chunks = size_to_chunks(size);
spin_lock(&pool->lock);