* Re: [PATCH] coredump: plug a memory leak situation on dump_seek()
[not found] <fe97698815cd081b5ab33a8c25c8b69cd0371a99.1267785456.git.andre.goddard@gmail.com>
@ 2010-03-09 3:08 ` KOSAKI Motohiro
2010-03-10 9:10 ` Cong Wang
1 sibling, 0 replies; 2+ messages in thread
From: KOSAKI Motohiro @ 2010-03-09 3:08 UTC (permalink / raw)
To: Andre Goddard Rosa
Cc: kosaki.motohiro, Andrew Morton, Alexander Viro, Roland McGrath,
WANG Cong, linux-fsdevel, linux-kernel
> After having started writing the coredump, if filesystem reports an error
> anytime while writing part of the core file, we would leak a memory page
> when bailing out.
>
> Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
> Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Looks good.
Thanks, Andre!
- kosaki
> ---
> include/linux/coredump.h | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/coredump.h b/include/linux/coredump.h
> index b3c91d7..8ba66a9 100644
> --- a/include/linux/coredump.h
> +++ b/include/linux/coredump.h
> @@ -16,6 +16,8 @@ static inline int dump_write(struct file *file, const void *addr, int nr)
>
> static inline 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;
> @@ -29,13 +31,15 @@ static inline int dump_seek(struct file *file, loff_t 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;
> }
>
> #endif /* _LINUX_COREDUMP_H */
> --
> 1.7.0.1.164.gbe2f
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] coredump: plug a memory leak situation on dump_seek()
[not found] <fe97698815cd081b5ab33a8c25c8b69cd0371a99.1267785456.git.andre.goddard@gmail.com>
2010-03-09 3:08 ` [PATCH] coredump: plug a memory leak situation on dump_seek() KOSAKI Motohiro
@ 2010-03-10 9:10 ` Cong Wang
1 sibling, 0 replies; 2+ messages in thread
From: Cong Wang @ 2010-03-10 9:10 UTC (permalink / raw)
To: André Goddard Rosa
Cc: KOSAKI Motohiro, Andrew Morton, Alexander Viro, Roland McGrath,
linux-fsdevel, linux-kernel
André Goddard Rosa wrote:
> After having started writing the coredump, if filesystem reports an error
> anytime while writing part of the core file, we would leak a memory page
> when bailing out.
>
> Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
> Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Looks good for me too!
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-10 9:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <fe97698815cd081b5ab33a8c25c8b69cd0371a99.1267785456.git.andre.goddard@gmail.com>
2010-03-09 3:08 ` [PATCH] coredump: plug a memory leak situation on dump_seek() KOSAKI Motohiro
2010-03-10 9:10 ` Cong Wang
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).