diff mbox

[infiniband-diags] ibqueryerrors: Fix crash when no SM is running

Message ID 553D14EA.3080703@dev.mellanox.co.il (mailing list archive)
State Superseded
Headers show

Commit Message

Hal Rosenstock April 26, 2015, 4:40 p.m. UTC
From: Vladimir Koushnir <vladimirk@mellanox.com>
Date: Tue, 21 Apr 2015 17:12:05 +0300

Handle sa_get_handle error in path_record_query

Signed-off-by: Vladimir Koushnir <vladimirk@mellanox.com>
---
 src/ibqueryerrors.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c
index 8fbb9d1..97a555d 100644
--- a/src/ibqueryerrors.c
+++ b/src/ibqueryerrors.c
@@ -326,7 +326,9 @@  static int path_record_query(ib_gid_t sgid,uint64_t dguid)
      uint8_t reversible = 0;
      struct sa_handle * h;
 
-     h = sa_get_handle();
+     if (!(h = sa_get_handle()))
+	return -1;
+
      ibd_timeout = DEFAULT_HALF_WORLD_PR_TIMEOUT;
      memset(&pr, 0, sizeof(pr));