public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: y@disappointment.disaster, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: only trace buffer items if they exist
Date: Mon, 9 Feb 2015 13:25:38 -0500	[thread overview]
Message-ID: <20150209182538.GG18336@laptop.bfoster> (raw)
In-Reply-To: <1423198008-30748-1-git-send-email-david@fromorbit.com>

On Fri, Feb 06, 2015 at 03:46:48PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> The commit 2d3d0c5 ("xfs: lobotomise xfs_trans_read_buf_map()") left
> a landmine in the tracing code: trace_xfs_trans_buf_read() is now
> call on all buffers that are read through this interface rather than
> just buffers in transactions. For buffers outside transaction
> context, bp->b_fspriv is null, and so the buf log item tracing
> functions cannot be called. This causes a NULL pointer dereference
> in the trace_xfs_trans_buf_read() function when tracing is turned
> on.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---

Ah, I hit this a week or so ago and completely forgot to dig into it.
Thanks!

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_trans_buf.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
> index 0a4d4ab..7579841 100644
> --- a/fs/xfs/xfs_trans_buf.c
> +++ b/fs/xfs/xfs_trans_buf.c
> @@ -327,9 +327,10 @@ xfs_trans_read_buf_map(
>  		return -EIO;
>  	}
>  
> -	if (tp)
> +	if (tp) {
>  		_xfs_trans_bjoin(tp, bp, 1);
> -	trace_xfs_trans_read_buf(bp->b_fspriv);
> +		trace_xfs_trans_read_buf(bp->b_fspriv);
> +	}
>  	*bpp = bp;
>  	return 0;
>  
> -- 
> 2.0.0
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2015-02-09 18:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06  4:46 [PATCH] xfs: only trace buffer items if they exist Dave Chinner
2015-02-09 18:25 ` Brian Foster [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=20150209182538.GG18336@laptop.bfoster \
    --to=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    --cc=y@disappointment.disaster \
    /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