* [2.4] binfmt_elf memleak (fix)
@ 2003-04-22 19:17 Oleg Drokin
0 siblings, 0 replies; only message in thread
From: Oleg Drokin @ 2003-04-22 19:17 UTC (permalink / raw)
To: alan, marcelo, linux-kernel, akpm
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;
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-04-22 19:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-22 19:17 [2.4] binfmt_elf memleak (fix) Oleg Drokin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.