@@ -1466,29 +1466,30 @@ struct elf_thread_status
14661466 * we need to keep a linked list of every thread's pr_status and then create
14671467 * a single section for them in the final core file.
14681468 */
1469- static int elf_dump_thread_status (long signr , struct elf_thread_status * t )
1469+ static struct elf_thread_status * elf_dump_thread_status (long signr , struct task_struct * p , int * sz )
14701470{
1471- struct task_struct * p = t -> thread ;
1472- int sz = 0 ;
1471+ struct elf_thread_status * t ;
14731472
1474- t -> num_notes = 0 ;
1473+ t = kzalloc (sizeof (struct elf_thread_status ), GFP_KERNEL );
1474+ if (!t )
1475+ return t ;
14751476
14761477 fill_prstatus (& t -> prstatus , p , signr );
14771478 elf_core_copy_task_regs (p , & t -> prstatus .pr_reg );
14781479
14791480 fill_note (& t -> notes [0 ], "CORE" , NT_PRSTATUS , sizeof (t -> prstatus ),
14801481 & t -> prstatus );
14811482 t -> num_notes ++ ;
1482- sz += notesize (& t -> notes [0 ]);
1483+ * sz += notesize (& t -> notes [0 ]);
14831484
14841485 t -> prstatus .pr_fpvalid = elf_core_copy_task_fpregs (p , NULL , & t -> fpu );
14851486 if (t -> prstatus .pr_fpvalid ) {
14861487 fill_note (& t -> notes [1 ], "CORE" , NT_PRFPREG , sizeof (t -> fpu ),
14871488 & t -> fpu );
14881489 t -> num_notes ++ ;
1489- sz += notesize (& t -> notes [1 ]);
1490+ * sz += notesize (& t -> notes [1 ]);
14901491 }
1491- return sz ;
1492+ return t ;
14921493}
14931494
14941495static void fill_extnum_info (struct elfhdr * elf , struct elf_shdr * shdr4extnum ,
@@ -1621,20 +1622,15 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
16211622
16221623 for (ct = current -> mm -> core_state -> dumper .next ;
16231624 ct ; ct = ct -> next ) {
1624- tmp = kzalloc (sizeof (* tmp ), GFP_KERNEL );
1625+ tmp = elf_dump_thread_status (cprm -> siginfo -> si_signo ,
1626+ ct -> task , & thread_status_size );
16251627 if (!tmp )
16261628 goto end_coredump ;
16271629
1628- tmp -> thread = ct -> task ;
16291630 tmp -> next = thread_list ;
16301631 thread_list = tmp ;
16311632 }
16321633
1633- for (tmp = thread_list ; tmp ; tmp = tmp -> next ) {
1634- int sz = elf_dump_thread_status (cprm -> siginfo -> si_signo , tmp );
1635- thread_status_size += sz ;
1636- }
1637-
16381634 /* now collect the dump for the current */
16391635 fill_prstatus (prstatus , current , cprm -> siginfo -> si_signo );
16401636 elf_core_copy_regs (& prstatus -> pr_reg , cprm -> regs );
0 commit comments