[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100302124206.4e0a42b4.akpm@linux-foundation.org>
Date: Tue, 2 Mar 2010 12:42:06 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: André Goddard Rosa <andre.goddard@...il.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Roland McGrath <roland@...hat.com>,
WANG Cong <amwang@...hat.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] binfmt_elf: plug a memory leak situation on dump_seek()
On Fri, 26 Feb 2010 00:54:40 -0300
Andr__ Goddard Rosa <andre.goddard@...il.com> wrote:
> Signed-off-by: Andr__ Goddard Rosa <andre.goddard@...il.com>
> ---
> fs/binfmt_elf.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index fd5b2ea..13b0845 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -1096,6 +1096,8 @@ static int dump_write(struct file *file, const void *addr, int nr)
>
> static int dump_seek(struct file *file, loff_t off)
> {
> + int ret = 1;
> +
> if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
> if (file->f_op->llseek(file, off, SEEK_CUR) < 0)
> return 0;
> @@ -1107,13 +1109,15 @@ static int dump_seek(struct file *file, loff_t off)
> unsigned long n = off;
> if (n > PAGE_SIZE)
> n = PAGE_SIZE;
> - if (!dump_write(file, buf, n))
> - return 0;
> + if (!dump_write(file, buf, n)) {
> + ret = 0;
> + break;
> + }
> off -= n;
> }
> free_page((unsigned long)buf);
> }
> - return 1;
> + return ret;
> }
Please don't send unchangelogged patches.
Explain the leak.
Explain the user impact (ie: how it is triggered).
Explain how the patch fixes it.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists