Re: [PATCH] coredump: prevent double-free on an error path in core dumper

2012-09-12 Thread Oleg Nesterov
On 09/12, Oleg Nesterov wrote: > > On 09/12, Venu Byravarasu wrote: > > > > > --- a/fs/binfmt_elf.c > > > +++ b/fs/binfmt_elf.c > > > @@ -1695,30 +1695,19 @@ static int elf_note_info_init(struct elf_note_info > > > *info) > > > return 0; > > > info->psinfo = kmalloc(sizeof(*info->psinfo

Re: [PATCH] coredump: prevent double-free on an error path in core dumper

2012-09-12 Thread Oleg Nesterov
On 09/12, Venu Byravarasu wrote: > > > --- a/fs/binfmt_elf.c > > +++ b/fs/binfmt_elf.c > > @@ -1695,30 +1695,19 @@ static int elf_note_info_init(struct elf_note_info > > *info) > > return 0; > > info->psinfo = kmalloc(sizeof(*info->psinfo), GFP_KERNEL); > > Why don't you change kmal

RE: [PATCH] coredump: prevent double-free on an error path in core dumper

2012-09-12 Thread Venu Byravarasu
t; Cc: Denys Vlasenko > Subject: [PATCH] coredump: prevent double-free on an error path in core > dumper > > In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate > memory > for info->fields, it frees already allocated stuff and returns > error to its

[PATCH] coredump: prevent double-free on an error path in core dumper

2012-09-12 Thread Denys Vlasenko
In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate memory for info->fields, it frees already allocated stuff and returns error to its caller, fill_note_info. Which in turn returns error to its caller, elf_core_dump. Which jumps to cleanup label and calls free_note_info, which wi