diff options
author | Dave Chinner <dchinner@redhat.com> | 2015-02-09 17:23:40 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2015-02-09 17:23:40 -0500 |
commit | e9892d3cc853afdda2cc69e2576d9ddb5fafad71 (patch) | |
tree | 83f14e59af392ab6880990b04bdbf1892e7acc74 | |
parent | 01f9882eac84b85421a469cb65ee9bb555a5985f (diff) |
xfs: only trace buffer items if they exist
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>
-rw-r--r-- | fs/xfs/xfs_trans_buf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c index 0a4d4ab6d9a9..75798412859a 100644 --- a/fs/xfs/xfs_trans_buf.c +++ b/fs/xfs/xfs_trans_buf.c | |||
@@ -327,9 +327,10 @@ xfs_trans_read_buf_map( | |||
327 | return -EIO; | 327 | return -EIO; |
328 | } | 328 | } |
329 | 329 | ||
330 | if (tp) | 330 | if (tp) { |
331 | _xfs_trans_bjoin(tp, bp, 1); | 331 | _xfs_trans_bjoin(tp, bp, 1); |
332 | trace_xfs_trans_read_buf(bp->b_fspriv); | 332 | trace_xfs_trans_read_buf(bp->b_fspriv); |
333 | } | ||
333 | *bpp = bp; | 334 | *bpp = bp; |
334 | return 0; | 335 | return 0; |
335 | 336 | ||