public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Luis Henriques <luis.henriques@canonical.com>
Cc: Bret Towe <magnade@gmail.com>,
	linux-kernel@vger.kernel.org, ocfs2-devel@oss.oracle.com,
	mfasheh@suse.com, jlbec@evilplan.org, sunil.mushran@oracle.com
Subject: Re: [PATCH] ocfs2: Fix NULL pointer dereferrence in __ocfs2_change_file_space
Date: Wed, 20 Jun 2012 15:42:52 -0700	[thread overview]
Message-ID: <20120620154252.7dc7a817.akpm@linux-foundation.org> (raw)
In-Reply-To: <1340231684-1667-1-git-send-email-luis.henriques@canonical.com>

On Wed, 20 Jun 2012 23:34:44 +0100
Luis Henriques <luis.henriques@canonical.com> wrote:

> As ocfs2_fallocate() will invoke __ocfs2_change_file_space() with a NULL
> as the first parameter (file), it may trigger a NULL pointer dereferrence
> due to a missing check.  See http://bugs.launchpad.net/bugs/1006012.
> 
> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> ---
>  fs/ocfs2/file.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index 6e39668..84822a4 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -1950,7 +1950,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
>  	if (ret < 0)
>  		mlog_errno(ret);
>  
> -	if (file->f_flags & O_SYNC)
> +	if (file && (file->f_flags & O_SYNC))
>  		handle->h_sync = 1;
>  
>  	ocfs2_commit_trans(osb, handle);

OK, at least it can't hurt ;)  I tagged it for -stable backporting.

Please don't forget the cc's and Tested-by:s.  There are quite a lot of
people involved in that launchpad report and they may like to know
what's going on, and can perhaps provide useful testing and review
input.  But I don't have their email addresses.


  parent reply	other threads:[~2012-06-20 22:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 22:23 BUG in ofcs2_change_file_space Bret Towe
2012-05-22  3:11 ` Bret Towe
2012-06-20 17:38   ` Bret Towe
2012-06-20 18:01     ` Luis Henriques
2012-06-20 21:56       ` Andrew Morton
2012-06-20 22:29         ` Luis Henriques
2012-06-20 22:34         ` [PATCH] ocfs2: Fix NULL pointer dereferrence in __ocfs2_change_file_space Luis Henriques
2012-06-20 22:39           ` Luis Henriques
2012-06-20 22:42           ` Andrew Morton [this message]
2012-06-20 23:18           ` Mark Fasheh
2012-06-21  6:12             ` Joel Becker
2012-06-21  4:39           ` Bret Towe

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=20120620154252.7dc7a817.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luis.henriques@canonical.com \
    --cc=magnade@gmail.com \
    --cc=mfasheh@suse.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=sunil.mushran@oracle.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