Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1173851

[PATCH 5/9] NTB: Fix oops in debugfs when transport is half-up

From Allen Hubbe <Allen.Hubbe@emc.com>
Newsgroups linux.kernel
Subject [PATCH 5/9] NTB: Fix oops in debugfs when transport is half-up
Date 2015-06-29 17:00 +0200
Message-ID <pGIHo-683-9@gated-at.bofh.it> (permalink)
References <pGIHn-683-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Dave Jiang <dave.jiang@intel.com>

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>
---
 drivers/ntb/ntb_transport.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 30d8b52421ec..1764bb2fd265 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -438,13 +438,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");
-- 
2.4.0.rc0.43.gcf8a8c6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/9] NTB: Fix and cleanup ntb drivers Allen Hubbe <Allen.Hubbe@emc.com> - 2015-06-29 17:00 +0200
  [PATCH 5/9] NTB: Fix oops in debugfs when transport is half-up Allen Hubbe <Allen.Hubbe@emc.com> - 2015-06-29 17:00 +0200
  [PATCH 6/9] NTB: Schedule to receive on QP link up Allen Hubbe <Allen.Hubbe@emc.com> - 2015-06-29 17:00 +0200
  [PATCH 8/9] NTB: Make the transport list in order of discovery Allen Hubbe <Allen.Hubbe@emc.com> - 2015-06-29 17:00 +0200
  [PATCH 3/9] NTB: Fix transport stats for multiple devices Allen Hubbe <Allen.Hubbe@emc.com> - 2015-06-29 17:00 +0200
  [PATCH 1/9] NTB: Fix ntb_transport out-of-order RX update Allen Hubbe <Allen.Hubbe@emc.com> - 2015-06-29 17:00 +0200
  RE: [PATCH 4/9] NTB: ntb_netdev not covering all receive errors "Hubbe, Allen" <Allen.Hubbe@emc.com> - 2015-06-29 17:10 +0200
  RE: [PATCH 0/9] NTB: Fix and cleanup ntb drivers "Hubbe, Allen" <Allen.Hubbe@emc.com> - 2015-06-29 17:20 +0200
  [PATCH 2/9] NTB: Add flow control to the ntb_netdev Allen Hubbe <Allen.Hubbe@emc.com> - 2015-06-29 17:30 +0200
    [PATCH 4/9] NTB: ntb_netdev not covering all receive errors Allen Hubbe <Allen.Hubbe@emc.com> - 2015-06-29 17:40 +0200

csiph-web