[PATCH rdma-core] srp_daemon: check that port LID is valid before calling create_ah

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Vladimir Koushnir <vladimirk@xxxxxxxxxxxx>

The default LID that is given to the port is not valid (a valid LID value
is > 0 and < 0xc000), so in case the port didn't get a valid lid from the
SM there is no need to call create_ah.

Signed-off-by: Vladimir Koushnir <vladimirk@xxxxxxxxxxxx>
Signed-off-by: Sergey Gorenko <sergeygo@xxxxxxxxxxxx>
---
 srp_daemon/srp_daemon.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c
index e85b96686d47..337b21c7d7c9 100644
--- a/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon.c
@@ -2228,8 +2228,9 @@ catas_start:
 			pr_debug("Starting a recalculation\n");
 			port_lid = get_port_lid(res->ud_res->ib_ctx,
 						config->port_num, &sm_lid);
-			if (port_lid != res->ud_res->port_attr.lid ||
-				sm_lid != res->ud_res->port_attr.sm_lid) {
+			if (port_lid > 0 && port_lid < 0xc000 &&
+			    (port_lid != res->ud_res->port_attr.lid ||
+			     sm_lid != res->ud_res->port_attr.sm_lid)) {
 
 				if (res->ud_res->ah) {
 					ibv_destroy_ah(res->ud_res->ah);
-- 
2.17.2




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux