linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] binfmt_elf: plug a memory leak situation on dump_seek()
       [not found] <322581998527c77c89d6fb91b8cbe02b5637c6dc.1267156293.git.andre.goddard@gmail.com>
@ 2010-03-02 20:42 ` Andrew Morton
  2010-03-03  2:02   ` KOSAKI Motohiro
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2010-03-02 20:42 UTC (permalink / raw)
  To: André Goddard Rosa
  Cc: Alexander Viro, Roland McGrath, WANG Cong, linux-fsdevel,
	linux-kernel

On Fri, 26 Feb 2010 00:54:40 -0300
Andr__ Goddard Rosa <andre.goddard@gmail.com> wrote:

> Signed-off-by: Andr__ Goddard Rosa <andre.goddard@gmail.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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] binfmt_elf: plug a memory leak situation on dump_seek()
  2010-03-02 20:42 ` [PATCH] binfmt_elf: plug a memory leak situation on dump_seek() Andrew Morton
@ 2010-03-03  2:02   ` KOSAKI Motohiro
  2010-03-03  2:17     ` André Goddard Rosa
  0 siblings, 1 reply; 3+ messages in thread
From: KOSAKI Motohiro @ 2010-03-03  2:02 UTC (permalink / raw)
  To: Andrew Morton, Andre Goddard Rosa
  Cc: kosaki.motohiro, Alexander Viro, Roland McGrath, WANG Cong,
	linux-fsdevel, linux-kernel

> On Fri, 26 Feb 2010 00:54:40 -0300
> Andr__ Goddard Rosa <andre.goddard@gmail.com> wrote:
> 
> > Signed-off-by: Andr__ Goddard Rosa <andre.goddard@gmail.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.

Hi Andre, 

plus, can you please rebase this patch onto -mmotm tree? it have lots elf core dump related
fix and it is going to be merged at this merge window, maybe.

I think your patch is correct. but I hope to avoid patch confliction.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] binfmt_elf: plug a memory leak situation on dump_seek()
  2010-03-03  2:02   ` KOSAKI Motohiro
@ 2010-03-03  2:17     ` André Goddard Rosa
  0 siblings, 0 replies; 3+ messages in thread
From: André Goddard Rosa @ 2010-03-03  2:17 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Andrew Morton, Alexander Viro, Roland McGrath, WANG Cong,
	linux-fsdevel, linux-kernel

Hi Kosaki Motohiro, Andrew,

>> 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.
>
> Hi Andre,
>
> plus, can you please rebase this patch onto -mmotm tree? it have lots elf core dump related
> fix and it is going to be merged at this merge window, maybe.
>
> I think your patch is correct. but I hope to avoid patch confliction.
>
> Thanks.
>

    Sure, I'm going to include a proper changelog, rebase it on top of
-mmotm tree and send a new patch soon.

Thank you,
André

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-03  2:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <322581998527c77c89d6fb91b8cbe02b5637c6dc.1267156293.git.andre.goddard@gmail.com>
2010-03-02 20:42 ` [PATCH] binfmt_elf: plug a memory leak situation on dump_seek() Andrew Morton
2010-03-03  2:02   ` KOSAKI Motohiro
2010-03-03  2:17     ` André Goddard Rosa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).