--- linux.2419/arch/ia64/kernel/perfmon.c.old Wed Aug 28 12:14:22 2002 +++ linux.2419/arch/ia64/kernel/perfmon.c Thu Aug 29 19:08:02 2002 @@ -767,15 +767,14 @@ psb = kmalloc(sizeof(*psb), GFP_KERNEL); if (psb == NULL) { DBprintk(("Can't allocate sampling buffer descriptor\n")); - pfm_rvfree(smpl_buf, size); - return -ENOMEM; + goto error_kmalloc; } /* allocate vma */ vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); if (!vma) { DBprintk(("Cannot allocate vma\n")); - goto error; + goto error_kmem; } /* * partially initialize the vma for the sampling buffer @@ -875,8 +874,11 @@ return 0; error: - pfm_rvfree(smpl_buf, size); + kmem_cache_free(vm_area_cachep, vma); +error_kmem: kfree(psb); +error_kmalloc: + pfm_rvfree(smpl_buf, size); return -ENOMEM; } @@ -1057,7 +1059,10 @@ /* * check if we can send this task a signal */ - if (pfm_bad_permissions(notify_task)) goto buffer_error; + if (pfm_bad_permissions(notify_task)) { + read_unlock(&tasklist_lock); + goto buffer_error; + } /* * make visible