Skip to content

Commit

Permalink
[PATCH] IPC: access to unmapped vmalloc area in grow_ary()
Browse files Browse the repository at this point in the history
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: Alexey Kuznetsov <[email protected]>
Signed-off-by: Kirill Korotaev <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexey Kuznetsov authored and Linus Torvalds committed Apr 18, 2006
1 parent 69cf0fa commit a9a5cd5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ipc/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ static int grow_ary(struct ipc_ids* ids, int newsize)
if(new == NULL)
return size;
new->size = newsize;
memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size +
sizeof(struct ipc_id_ary));
memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size);
for(i=size;i<newsize;i++) {
new->p[i] = NULL;
}
Expand Down

0 comments on commit a9a5cd5

Please sign in to comment.