Commit 1fca1649 authored by Alexey Kuznetsov's avatar Alexey Kuznetsov Committed by Greg Kroah-Hartman

[PATCH] IPC: access to unmapped vmalloc area in grow_ary()

grow_ary() should not copy struct ipc_id_ary (it copies new->p, not
new). Due to this, memcpy() src pointer could hit unmapped vmalloc page
when near page boundary.

Found during OpenVZ stress testing
Signed-off-by: default avatarAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: default avatarKirill Korotaev <dev@openvz.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7517f43b
...@@ -182,8 +182,7 @@ static int grow_ary(struct ipc_ids* ids, int newsize) ...@@ -182,8 +182,7 @@ static int grow_ary(struct ipc_ids* ids, int newsize)
if(new == NULL) if(new == NULL)
return size; return size;
new->size = newsize; new->size = newsize;
memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size + memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size);
sizeof(struct ipc_id_ary));
for(i=size;i<newsize;i++) { for(i=size;i<newsize;i++) {
new->p[i] = NULL; new->p[i] = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment