Commit 8af480ec authored by J. A. Magallon's avatar J. A. Magallon Committed by Linus Torvalds

[PATCH] pid allocator bugfix

This patch fixes a bug in the Linux process ID allocator.  It isn't quite
SMP safe since it references "last_pid" after releasing the lock protecting
it.  This can result in two processes getting assigned the same process ID.
parent 617ee601
......@@ -129,6 +129,7 @@ static int get_pid(unsigned long flags)
{
static int next_safe = PID_MAX;
struct task_struct *p;
int pid;
if (flags & CLONE_PID)
return current->pid;
......@@ -164,9 +165,10 @@ static int get_pid(unsigned long flags)
}
read_unlock(&tasklist_lock);
}
pid = last_pid;
spin_unlock(&lastpid_lock);
return last_pid;
return pid;
}
static inline int dup_mmap(struct mm_struct * mm)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment