Re: [PATCH] fix page leak during core dump

From: David Howells
Date: Sat Mar 31 2007 - 08:58:11 EST


Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxx> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/