summaryrefslogtreecommitdiffstats
path: root/drivers/ntb/ntb_transport.c
diff options
context:
space:
mode:
authorDave Jiang2015-07-13 14:07:11 +0200
committerJon Mason2015-08-09 22:32:22 +0200
commit260bee9451b4f0f5f9845c5b3024f0bfb8de8f22 (patch)
treedba4fe246963f2d57fa4b80d4b06325f3dea013c /drivers/ntb/ntb_transport.c
parentNTB: ntb_netdev not covering all receive errors (diff)
downloadkernel-qcow2-linux-260bee9451b4f0f5f9845c5b3024f0bfb8de8f22.tar.gz
kernel-qcow2-linux-260bee9451b4f0f5f9845c5b3024f0bfb8de8f22.tar.xz
kernel-qcow2-linux-260bee9451b4f0f5f9845c5b3024f0bfb8de8f22.zip
NTB: Fix oops in debugfs when transport is half-up
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>
Diffstat (limited to 'drivers/ntb/ntb_transport.c')
-rw-r--r--drivers/ntb/ntb_transport.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 25e973ff64cf..a049f96fab8d 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -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");