Eric Dumazet 81b1a832d7 pidns: fix NULL dereference in __task_pid_nr_ns()
I got a crash during a "perf top" session that was caused by a race in
__task_pid_nr_ns() :

pid_nr_ns() was inlined, but apparently compiler chose to read
task->pids[type].pid twice, and the pid->level dereference crashed
because we got a NULL pointer at the second read :

    if (pid && ns->level <= pid->level) { // CRASH

Just use RCU API properly to solve this race, and not worry about "perf
top" crashing hosts :(

get_task_pid() can benefit from same fix.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-24 12:03:55 -08:00
..
2015-06-30 19:44:57 -07:00
2015-04-11 22:27:55 -04:00
2014-10-09 22:26:04 -04:00
2015-11-04 08:23:51 -05:00
2014-08-08 15:57:18 -07:00
2015-04-12 21:03:31 +02:00
2015-11-04 21:50:37 -08:00
2015-08-03 11:34:16 +02:00
2014-09-10 15:42:12 -07:00
2015-11-10 12:07:22 -08:00
2014-12-04 14:34:54 -05:00
2015-01-17 10:02:23 +13:00
2015-11-05 19:34:48 -08:00
2014-12-10 17:41:10 -08:00