[ofa-general] [PATCH] When no DM ports are found return an error

Ira Weiny weiny2 at llnl.gov
Thu Apr 9 17:01:33 PDT 2009


I think I have found a bug in srp_daemon when running on a fabric with no SRP targets.

The patch below fixes the issue.  This is when running against OpenSM 3.2.5.  Without this fix the daemon goes into an endless loop looking for the node with lid 0!

Ira


From: Ira Weiny <weiny2 at llnl.gov>
Date: Thu, 9 Apr 2009 16:41:58 -0700
Subject: [PATCH] When no DM ports are found return an error.


Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
 srp_daemon/srp_daemon.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c
index 5e1e198..621678b 100644
--- a/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon.c
@@ -943,6 +943,9 @@ static int do_dm_port_list(struct resources *res)
 
 	size = ib_get_attr_size(in_sa_mad->attr_offset);
 
+	if (!size)
+		return -1;
+
 	for (i = 0; (i + 1) * size <= len - MAD_RMPP_HDR_SIZE; ++i) {
 		port_info = (void *) in_sa_mad->data + i * size;
 
-- 
1.5.4.5




More information about the general mailing list