Skip to content

Commit

Permalink
xfs: only trace buffer items if they exist
Browse files Browse the repository at this point in the history
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.

cc: <stable@vger.kernel.org>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
  • Loading branch information
Dave Chinner authored and Dave Chinner committed Feb 9, 2015
1 parent 01f9882 commit e9892d3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/xfs/xfs_trans_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit e9892d3

Please sign in to comment.