diff options
-rw-r--r-- | kernel/taskstats.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 2039585ec5e1..f45c5e70773c 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -455,10 +455,9 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats, | |||
455 | int is_thread_group; | 455 | int is_thread_group; |
456 | struct nlattr *na; | 456 | struct nlattr *na; |
457 | 457 | ||
458 | if (!family_registered || !tidstats) | 458 | if (!family_registered) |
459 | return; | 459 | return; |
460 | 460 | ||
461 | rc = 0; | ||
462 | /* | 461 | /* |
463 | * Size includes space for nested attributes | 462 | * Size includes space for nested attributes |
464 | */ | 463 | */ |
@@ -466,8 +465,15 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats, | |||
466 | nla_total_size(sizeof(struct taskstats)) + nla_total_size(0); | 465 | nla_total_size(sizeof(struct taskstats)) + nla_total_size(0); |
467 | 466 | ||
468 | is_thread_group = (tsk->signal->stats != NULL); | 467 | is_thread_group = (tsk->signal->stats != NULL); |
469 | if (is_thread_group) | 468 | if (is_thread_group) { |
470 | size = 2 * size; /* PID + STATS + TGID + STATS */ | 469 | /* PID + STATS + TGID + STATS */ |
470 | size = 2 * size; | ||
471 | /* fill the tsk->signal->stats structure */ | ||
472 | fill_tgid_exit(tsk); | ||
473 | } | ||
474 | |||
475 | if (!tidstats) | ||
476 | return; | ||
471 | 477 | ||
472 | rc = prepare_reply(NULL, TASKSTATS_CMD_NEW, &rep_skb, &reply, size); | 478 | rc = prepare_reply(NULL, TASKSTATS_CMD_NEW, &rep_skb, &reply, size); |
473 | if (rc < 0) | 479 | if (rc < 0) |
@@ -487,11 +493,8 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats, | |||
487 | goto send; | 493 | goto send; |
488 | 494 | ||
489 | /* | 495 | /* |
490 | * tsk has/had a thread group so fill the tsk->signal->stats structure | ||
491 | * Doesn't matter if tsk is the leader or the last group member leaving | 496 | * Doesn't matter if tsk is the leader or the last group member leaving |
492 | */ | 497 | */ |
493 | |||
494 | fill_tgid_exit(tsk); | ||
495 | if (!group_dead) | 498 | if (!group_dead) |
496 | goto send; | 499 | goto send; |
497 | 500 | ||