aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/pid.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/pid.c')
-rw-r--r--kernel/pid.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/pid.c b/kernel/pid.c
index d55c6fb8d087..57a8346a270e 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -217,11 +217,14 @@ static int alloc_pidmap(struct pid_namespace *pid_ns)
217 return -1; 217 return -1;
218} 218}
219 219
220int next_pidmap(struct pid_namespace *pid_ns, int last) 220int next_pidmap(struct pid_namespace *pid_ns, unsigned int last)
221{ 221{
222 int offset; 222 int offset;
223 struct pidmap *map, *end; 223 struct pidmap *map, *end;
224 224
225 if (last >= PID_MAX_LIMIT)
226 return -1;
227
225 offset = (last + 1) & BITS_PER_PAGE_MASK; 228 offset = (last + 1) & BITS_PER_PAGE_MASK;
226 map = &pid_ns->pidmap[(last + 1)/BITS_PER_PAGE]; 229 map = &pid_ns->pidmap[(last + 1)/BITS_PER_PAGE];
227 end = &pid_ns->pidmap[PIDMAP_ENTRIES]; 230 end = &pid_ns->pidmap[PIDMAP_ENTRIES];
@@ -401,7 +404,7 @@ struct task_struct *pid_task(struct pid *pid, enum pid_type type)
401 struct task_struct *result = NULL; 404 struct task_struct *result = NULL;
402 if (pid) { 405 if (pid) {
403 struct hlist_node *first; 406 struct hlist_node *first;
404 first = rcu_dereference_check(pid->tasks[type].first, 407 first = rcu_dereference_check(hlist_first_rcu(&pid->tasks[type]),
405 rcu_read_lock_held() || 408 rcu_read_lock_held() ||
406 lockdep_tasklist_lock_is_held()); 409 lockdep_tasklist_lock_is_held());
407 if (first) 410 if (first)
@@ -416,6 +419,7 @@ EXPORT_SYMBOL(pid_task);
416 */ 419 */
417struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns) 420struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
418{ 421{
422 rcu_lockdep_assert(rcu_read_lock_held());
419 return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID); 423 return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
420} 424}
421 425
@@ -434,6 +438,7 @@ struct pid *get_task_pid(struct task_struct *task, enum pid_type type)
434 rcu_read_unlock(); 438 rcu_read_unlock();
435 return pid; 439 return pid;
436} 440}
441EXPORT_SYMBOL_GPL(get_task_pid);
437 442
438struct task_struct *get_pid_task(struct pid *pid, enum pid_type type) 443struct task_struct *get_pid_task(struct pid *pid, enum pid_type type)
439{ 444{
@@ -445,6 +450,7 @@ struct task_struct *get_pid_task(struct pid *pid, enum pid_type type)
445 rcu_read_unlock(); 450 rcu_read_unlock();
446 return result; 451 return result;
447} 452}
453EXPORT_SYMBOL_GPL(get_pid_task);
448 454
449struct pid *find_get_pid(pid_t nr) 455struct pid *find_get_pid(pid_t nr)
450{ 456{