Messages in this thread Patch in this message | | | Date | Tue, 22 Apr 2003 23:17:40 +0400 | From | Oleg Drokin <> | Subject | [2.4] binfmt_elf memleak (fix) |
| |
Hello!
Some time ago I have found a memleak in binfmt_elf.c in 2.5, that was quickly fixed by Andrew Morton. The same problem is present in current 2.4 tree. Andrew's fix applies to 2.4 with a little fuzz and the result looks correct to me. Consider applying following patch (against latest 2.4 bk tree).
Bye, Oleg
===== fs/binfmt_elf.c 1.21 vs edited ===== --- 1.21/fs/binfmt_elf.c Sat May 4 21:05:24 2002 +++ edited/fs/binfmt_elf.c Tue Apr 22 23:09:38 2003 @@ -375,7 +375,6 @@ unsigned long text_data, elf_entry = ~0UL; char * addr; loff_t offset; - int retval; current->mm->end_code = interp_ex->a_text; text_data = interp_ex->a_text + interp_ex->a_data; @@ -397,11 +396,9 @@ } do_brk(0, text_data); - retval = -ENOEXEC; if (!interpreter->f_op || !interpreter->f_op->read) goto out; - retval = interpreter->f_op->read(interpreter, addr, text_data, &offset); - if (retval < 0) + if (interpreter->f_op->read(interpreter, addr, text_data, &offset) < 0) goto out; flush_icache_range((unsigned long)addr, (unsigned long)addr + text_data); @@ -607,7 +604,7 @@ retval = setup_arg_pages(bprm); if (retval < 0) { send_sig(SIGKILL, current, 0); - return retval; + goto out_free_dentry; } current->mm->start_stack = bprm->p; @@ -711,7 +708,8 @@ printk(KERN_ERR "Unable to load interpreter\n"); kfree(elf_phdata); send_sig(SIGSEGV, current, 0); - return 0; + retval = -ENOEXEC; /* Nobody gets to see this, but.. */ + goto out; } } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |