From: Ira Weiny Date: Thu, 14 May 2015 00:02:57 +0000 (-0400) Subject: IB/user_mad: Fix buggy usage of port index X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=26c454288a4beac774ea31c15284783fcd75721d;p=linux-beck.git IB/user_mad: Fix buggy usage of port index The addition of the rdma_cap_ib_mad is technically broken in ib_umad_remove_one because the loop "i" value is not a port value. This bug resulted in the ib_umad failing to properly remove its resources when the core capability functions were converted to bit fields. NOTE: e17371d73908 did not result in broken behavior on its own. It was only an issue when the implementation of rdma_cap_ib_mad was changed. Pass the port value to rdma_cap_ib_mad. Fixes: e17371d73908 ("IB/Verbs: Use management helper rdma_cap_ib_mad()") Signed-off-by: Ira Weiny Signed-off-by: Doug Ledford --- diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index cc5001e850de..278cfaee9a94 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c @@ -1325,7 +1325,7 @@ static void ib_umad_remove_one(struct ib_device *device) return; for (i = 0; i <= rdma_end_port(device) - rdma_start_port(device); ++i) { - if (rdma_cap_ib_mad(device, i)) + if (rdma_cap_ib_mad(device, i + rdma_start_port(device))) ib_umad_kill_port(&umad_dev->port[i]); }