Re: [PATCH] fix page leak during core dump

David Howells
2007-03-31T12:57:54Z

Andrew Morton <akpm@linux-foundation.org> wrote:

> <would anyone be interested in hearing my opinion on the DUMP_SEEK macro
> again?>

I can guess. And it's very probably right. Macros containing return
statements like that are dodgy as they help people screw up the error handling.

However, ...

Andrew Morton <akpm@linux-foundation.org> wrote:

> - DUMP_SEEK(file->f_pos + PAGE_SIZE);
> - page_cache_release(page);
> + if (!dump_seek(file, file->f_pos + PAGE_SIZE)) {
> + page_cache_release(page);
> + return 0;
> + }

Is not correct as you've then eliminated the page_cache_release() on the
success path. What you probably intended was:

int tmp;
...
tmp = dump_seek(file, file->f_pos + PAGE_SIZE);
page_cache_release(page);
if (!tmp)
return 0;

David