Skip to content

Commit

Permalink
NTB: Fix oops in debugfs when transport is half-up
Browse files Browse the repository at this point in the history
When the remote side is not up, we do not have all the context for the
transport, and that causes NULL ptr access. Have the debugfs reads check
to see if transport is up before we make access.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
  • Loading branch information
Dave Jiang authored and Jon Mason committed Aug 9, 2015
1 parent da4eb27 commit 260bee9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/ntb/ntb_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,17 @@ static ssize_t debugfs_read(struct file *filp, char __user *ubuf, size_t count,
char *buf;
ssize_t ret, out_offset, out_count;

qp = filp->private_data;

if (!qp || !qp->link_is_up)
return 0;

out_count = 1000;

buf = kmalloc(out_count, GFP_KERNEL);
if (!buf)
return -ENOMEM;

qp = filp->private_data;
out_offset = 0;
out_offset += snprintf(buf + out_offset, out_count - out_offset,
"NTB QP stats\n");
Expand Down

0 comments on commit 260bee9

Please sign in to comment.