Subject: [PATCH iproute2-next 05/10] rdma: Check that port index exists before operate on link layer

From: Leon Romanovsky <[email-masked]>
Date: Wed, 27 Dec 2017 09:57:54 +0200

From: Leon Romanovsky <[email-masked]>

Link layer operates on port layer, hence it should check
it existence before execution commands.

Fixes: da990ab40a92 ("rdma: Add link object")
Signed-off-by: Leon Romanovsky <[email-masked]>
---
 rdma/link.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/rdma/link.c b/rdma/link.c
index f0eaccbb..d9392289 100644
--- a/rdma/link.c
+++ b/rdma/link.c
@@ -277,6 +277,9 @@ static int link_one_show(struct rd *rd)
 		{ 0 }
 	};
 
+	if (!rd->port_idx)
+		return 0;
+
 	return rd_exec_cmd(rd, cmds, "parameter");
 }
 
-- 
2.15.1