fix clean-up path in create_process()
This commit is contained in:
@@ -84,14 +84,11 @@ struct process *create_process(unsigned long user_pc)
|
|||||||
|
|
||||||
proc->sighandler = kmalloc(sizeof(struct sig_handler), IHK_MC_AP_NOWAIT);
|
proc->sighandler = kmalloc(sizeof(struct sig_handler), IHK_MC_AP_NOWAIT);
|
||||||
if(!proc->sighandler){
|
if(!proc->sighandler){
|
||||||
ihk_mc_free_pages(proc, KERNEL_STACK_NR_PAGES);
|
goto err_free_process;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
proc->sigshared = kmalloc(sizeof(struct sig_shared), IHK_MC_AP_NOWAIT);
|
proc->sigshared = kmalloc(sizeof(struct sig_shared), IHK_MC_AP_NOWAIT);
|
||||||
if(!proc->sigshared){
|
if(!proc->sigshared){
|
||||||
ihk_mc_free_pages(proc->sighandler, KERNEL_STACK_NR_PAGES);
|
goto err_free_sighandler;
|
||||||
ihk_mc_free_pages(proc, KERNEL_STACK_NR_PAGES);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
memset(proc->sighandler, '\0', sizeof(struct sig_handler));
|
memset(proc->sighandler, '\0', sizeof(struct sig_handler));
|
||||||
ihk_atomic_set(&proc->sighandler->use, 1);
|
ihk_atomic_set(&proc->sighandler->use, 1);
|
||||||
@@ -109,16 +106,24 @@ struct process *create_process(unsigned long user_pc)
|
|||||||
proc->vm = (struct process_vm *)(proc + 1);
|
proc->vm = (struct process_vm *)(proc + 1);
|
||||||
|
|
||||||
if(init_process_vm(proc, proc->vm) != 0){
|
if(init_process_vm(proc, proc->vm) != 0){
|
||||||
kfree(proc->sigshared);
|
goto err_free_sigshared;
|
||||||
kfree(proc->sighandler);
|
|
||||||
ihk_mc_free_pages(proc, KERNEL_STACK_NR_PAGES);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ihk_mc_spinlock_init(&proc->spin_sleep_lock);
|
ihk_mc_spinlock_init(&proc->spin_sleep_lock);
|
||||||
proc->spin_sleep = 0;
|
proc->spin_sleep = 0;
|
||||||
|
|
||||||
return proc;
|
return proc;
|
||||||
|
|
||||||
|
err_free_sigshared:
|
||||||
|
kfree(proc->sigshared);
|
||||||
|
|
||||||
|
err_free_sighandler:
|
||||||
|
kfree(proc->sighandler);
|
||||||
|
|
||||||
|
err_free_process:
|
||||||
|
ihk_mc_free_pages(proc, KERNEL_STACK_NR_PAGES);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct process *clone_process(struct process *org, unsigned long pc,
|
struct process *clone_process(struct process *org, unsigned long pc,
|
||||||
|
|||||||
Reference in New Issue
Block a user