[elf-fdpic] coredump: don't bother with cyclic list for per-thread objects
plain single-linked list is just fine here... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
7a896028ad
commit
5074c7f69f
|
@ -1453,7 +1453,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
|
||||||
/* Here is the structure in which status of each thread is captured. */
|
/* Here is the structure in which status of each thread is captured. */
|
||||||
struct elf_thread_status
|
struct elf_thread_status
|
||||||
{
|
{
|
||||||
struct list_head list;
|
struct elf_thread_status *next;
|
||||||
struct elf_prstatus_fdpic prstatus; /* NT_PRSTATUS */
|
struct elf_prstatus_fdpic prstatus; /* NT_PRSTATUS */
|
||||||
elf_fpregset_t fpu; /* NT_PRFPREG */
|
elf_fpregset_t fpu; /* NT_PRFPREG */
|
||||||
struct task_struct *thread;
|
struct task_struct *thread;
|
||||||
|
@ -1578,8 +1578,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
|
||||||
struct memelfnote *notes = NULL;
|
struct memelfnote *notes = NULL;
|
||||||
struct elf_prstatus_fdpic *prstatus = NULL; /* NT_PRSTATUS */
|
struct elf_prstatus_fdpic *prstatus = NULL; /* NT_PRSTATUS */
|
||||||
struct elf_prpsinfo *psinfo = NULL; /* NT_PRPSINFO */
|
struct elf_prpsinfo *psinfo = NULL; /* NT_PRPSINFO */
|
||||||
LIST_HEAD(thread_list);
|
struct elf_thread_status *thread_list = NULL;
|
||||||
struct list_head *t;
|
|
||||||
elf_fpregset_t *fpu = NULL;
|
elf_fpregset_t *fpu = NULL;
|
||||||
int thread_status_size = 0;
|
int thread_status_size = 0;
|
||||||
elf_addr_t *auxv;
|
elf_addr_t *auxv;
|
||||||
|
@ -1627,15 +1626,12 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
|
||||||
goto end_coredump;
|
goto end_coredump;
|
||||||
|
|
||||||
tmp->thread = ct->task;
|
tmp->thread = ct->task;
|
||||||
list_add(&tmp->list, &thread_list);
|
tmp->next = thread_list;
|
||||||
|
thread_list = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_for_each(t, &thread_list) {
|
for (tmp = thread_list; tmp; tmp = tmp->next) {
|
||||||
struct elf_thread_status *tmp;
|
int sz = elf_dump_thread_status(cprm->siginfo->si_signo, tmp);
|
||||||
int sz;
|
|
||||||
|
|
||||||
tmp = list_entry(t, struct elf_thread_status, list);
|
|
||||||
sz = elf_dump_thread_status(cprm->siginfo->si_signo, tmp);
|
|
||||||
thread_status_size += sz;
|
thread_status_size += sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1760,10 +1756,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
|
||||||
goto end_coredump;
|
goto end_coredump;
|
||||||
|
|
||||||
/* write out the thread status notes section */
|
/* write out the thread status notes section */
|
||||||
list_for_each(t, &thread_list) {
|
for (tmp = thread_list; tmp; tmp = tmp->next) {
|
||||||
struct elf_thread_status *tmp =
|
|
||||||
list_entry(t, struct elf_thread_status, list);
|
|
||||||
|
|
||||||
for (i = 0; i < tmp->num_notes; i++)
|
for (i = 0; i < tmp->num_notes; i++)
|
||||||
if (!writenote(&tmp->notes[i], cprm))
|
if (!writenote(&tmp->notes[i], cprm))
|
||||||
goto end_coredump;
|
goto end_coredump;
|
||||||
|
@ -1791,10 +1784,10 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
|
||||||
}
|
}
|
||||||
|
|
||||||
end_coredump:
|
end_coredump:
|
||||||
while (!list_empty(&thread_list)) {
|
while (thread_list) {
|
||||||
struct list_head *tmp = thread_list.next;
|
tmp = thread_list;
|
||||||
list_del(tmp);
|
thread_list = thread_list->next;
|
||||||
kfree(list_entry(tmp, struct elf_thread_status, list));
|
kfree(tmp);
|
||||||
}
|
}
|
||||||
kfree(phdr4note);
|
kfree(phdr4note);
|
||||||
kfree(elf);
|
kfree(elf);
|
||||||
|
|
Loading…
Reference in a new issue