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

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
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 Mon, 29 Jun 2015 17:00:02 +0200
Message-ID <pGIHo-683-9@gated-at.bofh.it> (permalink)
References <pGIHn-683-5@gated-at.bofh.it>
X-Original-To linux-ntb@googlegroups.com
X-Dkim OpenDKIM Filter v2.4.3 mailuogwprd01.lss.emc.com t5TEoTwl026704
Dkim-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=emc.com; s=jan2013; t=1435589431; bh=NOk466x8z2MZuQ3pUMbNoFBdb7A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: In-Reply-To:References; b=dHPTaIGCh28E9FsiBGwGIE5rhCyVynkft/K8sbI6H8zFhVO4OeueCEmSSTcvn4f7c V6Csi9PG1sBFx8LySh7oS7iKjPPrFGIQwQW1DUCxbzS14NZbbWnErPBdUPS3HPZ7AH Twlns+ephRDDzeC3osgIaiN/EmoBUA5ab9imtrLY=
X-Dkim OpenDKIM Filter v2.4.3 mailuogwprd01.lss.emc.com t5TEoTwl026704
X-Mailer git-send-email 2.4.0.rc0.44.g244209c.dirty
X-Rsa-Classifications public
X-Sentrion-Hostname mailuogwprd01.lss.emc.com
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 42
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Jon Mason <jdmason@kudzu.us>, Dave Jiang <dave.jiang@intel.com>, Allen Hubbe <Allen.Hubbe@emc.com>
X-Original-Date Mon, 29 Jun 2015 10:50:01 -0400
X-Original-Message-ID <dc46fafa9893ffa92dad1a95fda17627dfff8c8a.1435587291.git.Allen.Hubbe@emc.com>
X-Original-References <cover.1435587291.git.Allen.Hubbe@emc.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1173851

Show key headers only | 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