Correct a reference counting bug in shmat(2). If vm_map_find(9)

failed, the reference count for the virtual memory object referenced
by the specified shared memory segment would have been erroneously
incremented.

Reported by:	Joost Pol <joost@pine.nl>
This commit is contained in:
Jacques Vidrine 2004-02-05 18:00:35 +00:00
parent dec8868dcc
commit b00a3c85da
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125488

View File

@ -378,6 +378,7 @@ kern_shmat(td, shmid, shmaddr, shmflg)
rv = vm_map_find(&p->p_vmspace->vm_map, shm_handle->shm_object,
0, &attach_va, size, (flags & MAP_FIXED)?0:1, prot, prot, 0);
if (rv != KERN_SUCCESS) {
vm_object_deallocate(shm_handle->shm_object);
error = ENOMEM;
goto done2;
}