rdma: Check that port index exists before operate on link layer

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

Fixes: da990ab40a ("rdma: Add link object")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
Leon Romanovsky 2017-12-27 09:57:54 +02:00 committed by David Ahern
parent 4e2eb9fdf9
commit e3dee3c81f
1 changed files with 3 additions and 0 deletions

View File

@ -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");
}