Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9a5cd5d authored by Alexey Kuznetsov's avatar Alexey Kuznetsov Committed by Linus Torvalds
Browse files

[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>
parent 69cf0fac
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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;
	}