]> Git Repo - linux.git/commit
pids: introduce change_pid() helper
authorOleg Nesterov <[email protected]>
Wed, 30 Apr 2008 07:54:26 +0000 (00:54 -0700)
committerLinus Torvalds <[email protected]>
Wed, 30 Apr 2008 15:29:48 +0000 (08:29 -0700)
commit24336eaeecea860b2a82530e07c80bc7e0558b73
tree12a34660f732e12ba18262083c1a2eea5a824f6a
parent65450cebc6a2efde80ed45514f727e6e4dc1eafd
pids: introduce change_pid() helper

Based on Eric W. Biederman's idea.

Without tasklist_lock held task_session()/task_pgrp() can return NULL if the
caller races with setprgp()/setsid() which does detach_pid() + attach_pid().
This can happen even if task == current.

Intoduce the new helper, change_pid(), which should be used instead.  This way
the caller always sees the special pid != NULL, either old or new.

Also change the prototype of attach_pid(), it always returns 0 and nobody
check the returned value.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Cc: Roland McGrath <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/pid.h
kernel/pid.c
This page took 0.055512 seconds and 4 git commands to generate.