mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Abhijit Pawar <abhi.c.pawar@gmail.com>
Cc: Joern Engel <joern@logfs.org>,
	Prasad Joshi <prasadjoshi.linux@gmail.com>,
	logfs@logfs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] fs: logfs NULL pointer check added
Date: Fri, 7 Dec 2012 16:29:07 -0800	[thread overview]
Message-ID: <20121207162907.a9e4a3d9.akpm@linux-foundation.org> (raw)
In-Reply-To: <1354015498-8986-1-git-send-email-abhi.c.pawar@gmail.com>

On Tue, 27 Nov 2012 16:54:58 +0530
Abhijit Pawar <abhi.c.pawar@gmail.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@gmail.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.


      reply	other threads:[~2012-12-08  0:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 11:24 Abhijit Pawar
2012-12-08  0:29 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121207162907.a9e4a3d9.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=abhi.c.pawar@gmail.com \
    --cc=joern@logfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=logfs@logfs.org \
    --cc=prasadjoshi.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome