diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-10-14 07:39:56 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-11-09 00:16:30 -0500 |
commit | afabada957a6b28abfd37eb52efeefdfe6871c4b (patch) | |
tree | e5ef8085293b1b5855eff339a2930f6cf35bc380 | |
parent | ec57941e031685de434916e5398d0ca1d44cd374 (diff) |
elf{,_fdpic} coredump: get rid of pointless if (siginfo->si_signo)
we can't get to do_coredump() if that condition isn't satisfied...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/binfmt_elf.c | 33 | ||||
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 35 |
2 files changed, 31 insertions, 37 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 1af412b96e06..571a42326908 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1833,31 +1833,28 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, | |||
1833 | const siginfo_t *siginfo, struct pt_regs *regs) | 1833 | const siginfo_t *siginfo, struct pt_regs *regs) |
1834 | { | 1834 | { |
1835 | struct list_head *t; | 1835 | struct list_head *t; |
1836 | struct core_thread *ct; | ||
1837 | struct elf_thread_status *ets; | ||
1836 | 1838 | ||
1837 | if (!elf_note_info_init(info)) | 1839 | if (!elf_note_info_init(info)) |
1838 | return 0; | 1840 | return 0; |
1839 | 1841 | ||
1840 | if (siginfo->si_signo) { | 1842 | for (ct = current->mm->core_state->dumper.next; |
1841 | struct core_thread *ct; | 1843 | ct; ct = ct->next) { |
1842 | struct elf_thread_status *ets; | 1844 | ets = kzalloc(sizeof(*ets), GFP_KERNEL); |
1843 | 1845 | if (!ets) | |
1844 | for (ct = current->mm->core_state->dumper.next; | 1846 | return 0; |
1845 | ct; ct = ct->next) { | ||
1846 | ets = kzalloc(sizeof(*ets), GFP_KERNEL); | ||
1847 | if (!ets) | ||
1848 | return 0; | ||
1849 | 1847 | ||
1850 | ets->thread = ct->task; | 1848 | ets->thread = ct->task; |
1851 | list_add(&ets->list, &info->thread_list); | 1849 | list_add(&ets->list, &info->thread_list); |
1852 | } | 1850 | } |
1853 | 1851 | ||
1854 | list_for_each(t, &info->thread_list) { | 1852 | list_for_each(t, &info->thread_list) { |
1855 | int sz; | 1853 | int sz; |
1856 | 1854 | ||
1857 | ets = list_entry(t, struct elf_thread_status, list); | 1855 | ets = list_entry(t, struct elf_thread_status, list); |
1858 | sz = elf_dump_thread_status(siginfo->si_signo, ets); | 1856 | sz = elf_dump_thread_status(siginfo->si_signo, ets); |
1859 | info->thread_status_size += sz; | 1857 | info->thread_status_size += sz; |
1860 | } | ||
1861 | } | 1858 | } |
1862 | /* now collect the dump for the current */ | 1859 | /* now collect the dump for the current */ |
1863 | memset(info->prstatus, 0, sizeof(*info->prstatus)); | 1860 | memset(info->prstatus, 0, sizeof(*info->prstatus)); |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 645f6e56f378..fe2a643ee005 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -1561,6 +1561,8 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) | |||
1561 | struct elf_shdr *shdr4extnum = NULL; | 1561 | struct elf_shdr *shdr4extnum = NULL; |
1562 | Elf_Half e_phnum; | 1562 | Elf_Half e_phnum; |
1563 | elf_addr_t e_shoff; | 1563 | elf_addr_t e_shoff; |
1564 | struct core_thread *ct; | ||
1565 | struct elf_thread_status *tmp; | ||
1564 | 1566 | ||
1565 | /* | 1567 | /* |
1566 | * We no longer stop all VM operations. | 1568 | * We no longer stop all VM operations. |
@@ -1596,28 +1598,23 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) | |||
1596 | goto cleanup; | 1598 | goto cleanup; |
1597 | #endif | 1599 | #endif |
1598 | 1600 | ||
1599 | if (cprm->siginfo->si_signo) { | 1601 | for (ct = current->mm->core_state->dumper.next; |
1600 | struct core_thread *ct; | 1602 | ct; ct = ct->next) { |
1601 | struct elf_thread_status *tmp; | 1603 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); |
1602 | 1604 | if (!tmp) | |
1603 | for (ct = current->mm->core_state->dumper.next; | 1605 | goto cleanup; |
1604 | ct; ct = ct->next) { | ||
1605 | tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); | ||
1606 | if (!tmp) | ||
1607 | goto cleanup; | ||
1608 | 1606 | ||
1609 | tmp->thread = ct->task; | 1607 | tmp->thread = ct->task; |
1610 | list_add(&tmp->list, &thread_list); | 1608 | list_add(&tmp->list, &thread_list); |
1611 | } | 1609 | } |
1612 | 1610 | ||
1613 | list_for_each(t, &thread_list) { | 1611 | list_for_each(t, &thread_list) { |
1614 | struct elf_thread_status *tmp; | 1612 | struct elf_thread_status *tmp; |
1615 | int sz; | 1613 | int sz; |
1616 | 1614 | ||
1617 | tmp = list_entry(t, struct elf_thread_status, list); | 1615 | tmp = list_entry(t, struct elf_thread_status, list); |
1618 | sz = elf_dump_thread_status(cprm->siginfo->si_signo, tmp); | 1616 | sz = elf_dump_thread_status(cprm->siginfo->si_signo, tmp); |
1619 | thread_status_size += sz; | 1617 | thread_status_size += sz; |
1620 | } | ||
1621 | } | 1618 | } |
1622 | 1619 | ||
1623 | /* now collect the dump for the current */ | 1620 | /* now collect the dump for the current */ |