[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20121207162907.a9e4a3d9.akpm@linux-foundation.org>
Date: Fri, 7 Dec 2012 16:29:07 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Abhijit Pawar <abhi.c.pawar@...il.com>
Cc: Joern Engel <joern@...fs.org>,
Prasad Joshi <prasadjoshi.linux@...il.com>, logfs@...fs.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] fs: logfs NULL pointer check added
On Tue, 27 Nov 2012 16:54:58 +0530
Abhijit Pawar <abhi.c.pawar@...il.com> wrote:
> This patch fixes Bug 49921 - Missing NULL check of return value of logfs_get_write_page() in function btree_write_block()
>
> Signed-off-by: Abhijit Pawar <abhi.c.pawar@...il.com>
> ---
> fs/logfs/readwrite.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c
> index e1a3b6b..53596ce 100644
> --- a/fs/logfs/readwrite.c
> +++ b/fs/logfs/readwrite.c
> @@ -2202,6 +2202,7 @@ void btree_write_block(struct logfs_block *block)
>
> inode = logfs_safe_iget(block->sb, block->ino, &cookie);
> page = logfs_get_write_page(inode, block->bix, block->level);
> + BUG_ON(!page);
>
> err = logfs_readpage_nolock(page);
> BUG_ON(err);
We don't gain anything from this change. If page==NULL then
logfs_readpage_nolock() will oops and will provide the same information
as BUG().
A better fix would be to teach logfs_get_write_page() to return a
proper ERR_PTR errno (not just a gee-i-goofed boolean, guys) then teach
btree_write_block() to process that error appropriately: clean up and
propagate it back.
Right now, a visit from the oom-killer will cause btree_write_block()
to kill the kernel.
--
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