Skip to content

Commit 4ec3c15

Browse files
Sebastian Andrzej SiewiorKAGA-KOKO
authored andcommitted
futex: Use correct exit on failure from futex_hash_allocate_default()
copy_process() uses the wrong error exit path from futex_hash_allocate_default(). After exiting from futex_hash_allocate_default(), neither tasklist_lock nor siglock has been acquired. The exit label bad_fork_core_free unlocks both of these locks which is wrong. The next exit label, bad_fork_cancel_cgroup, is the correct exit. sched_cgroup_fork() did not allocate any resources that need to freed. Use bad_fork_cancel_cgroup on error exit from futex_hash_allocate_default(). Fixes: 7c4f75a ("futex: Allow automatic allocation of process wide futex hash") Reported-by: [email protected] Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Steven Rostedt (Google) <[email protected]> Closes: https://lore.kernel.org/all/[email protected]
1 parent b549113 commit 4ec3c15

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/fork.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2295,7 +2295,7 @@ __latent_entropy struct task_struct *copy_process(
22952295
if (need_futex_hash_allocate_default(clone_flags)) {
22962296
retval = futex_hash_allocate_default();
22972297
if (retval)
2298-
goto bad_fork_core_free;
2298+
goto bad_fork_cancel_cgroup;
22992299
/*
23002300
* If we fail beyond this point we don't free the allocated
23012301
* futex hash map. We assume that another thread will be created

0 commit comments

Comments
 (0)