Message ID | 20190730105455.15080-1-sergeygo@mellanox.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [rdma-core] srp_daemon: check that port LID is valid before calling create_ah | expand |
On 7/30/19 3:54 AM, Sergey Gorenko wrote: > From: Vladimir Koushnir <vladimirk@mellanox.com> > > 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@mellanox.com> > Signed-off-by: Sergey Gorenko <sergeygo@mellanox.com> > --- > 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); > Reviewed-by: Bart Van Assche <bvanassche@acm.org>
On Tue, 2019-07-30 at 10:54 +0000, Sergey Gorenko wrote: > From: Vladimir Koushnir <vladimirk@mellanox.com> > > 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@mellanox.com> > Signed-off-by: Sergey Gorenko <sergeygo@mellanox.com> > --- Thanks, applied.
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);