aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/cma.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-09-11 14:46:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-09-11 14:46:11 -0400
commit28a0ea77ba50fc8a9684b7af96ece05dfeb6f64b (patch)
treee524d8dc70d740f120f787f8da96861fafea41ac /drivers/infiniband/core/cma.c
parent11da3a7f84f19c26da6f86af878298694ede0804 (diff)
parent8f28b178f71cc56eccf2a6e2c0ace17c82f900d7 (diff)
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma fixes from Jason Gunthorpe: "This fixes one major regression with NFS and mlx4 due to the max_sg rework in this merge window, tidies a few minor error_path regressions, and various small fixes. The HFI1 driver is broken this cycle due to a regression caused by a PCI change, it is looking like Bjorn will merge a fix for this. Also, the lingering ipoib issue I mentioned earlier still remains unfixed. Summary: - Fix possible FD type confusion crash - Fix a user trigger-able crash in cxgb4 - Fix bad handling of IOMMU resources causing user controlled leaking in bnxt - Add missing locking in ipoib to fix a rare 'stuck tx' situation - Add missing locking in cma - Add two missing missing uverbs cleanups on failure paths, regressions from this merge window - Fix a regression from this merge window that caused RDMA NFS to not work with the mlx4 driver due to the max_sg changes" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA/mlx4: Ensure that maximal send/receive SGE less than supported by HW RDMA/cma: Protect cma dev list with lock RDMA/uverbs: Fix error cleanup path of ib_uverbs_add_one() bnxt_re: Fix couple of memory leaks that could lead to IOMMU call traces IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler iw_cxgb4: only allow 1 flush on user qps IB/core: Release object lock if destroy failed RDMA/ucma: check fd type in ucma_migrate_id()
Diffstat (limited to 'drivers/infiniband/core/cma.c')
-rw-r--r--drivers/infiniband/core/cma.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index f72677291b69..a36c94930c31 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -724,6 +724,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
724 dgid = (union ib_gid *) &addr->sib_addr; 724 dgid = (union ib_gid *) &addr->sib_addr;
725 pkey = ntohs(addr->sib_pkey); 725 pkey = ntohs(addr->sib_pkey);
726 726
727 mutex_lock(&lock);
727 list_for_each_entry(cur_dev, &dev_list, list) { 728 list_for_each_entry(cur_dev, &dev_list, list) {
728 for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) { 729 for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
729 if (!rdma_cap_af_ib(cur_dev->device, p)) 730 if (!rdma_cap_af_ib(cur_dev->device, p))
@@ -750,18 +751,19 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
750 cma_dev = cur_dev; 751 cma_dev = cur_dev;
751 sgid = gid; 752 sgid = gid;
752 id_priv->id.port_num = p; 753 id_priv->id.port_num = p;
754 goto found;
753 } 755 }
754 } 756 }
755 } 757 }
756 } 758 }
757 759 mutex_unlock(&lock);
758 if (!cma_dev) 760 return -ENODEV;
759 return -ENODEV;
760 761
761found: 762found:
762 cma_attach_to_dev(id_priv, cma_dev); 763 cma_attach_to_dev(id_priv, cma_dev);
763 addr = (struct sockaddr_ib *) cma_src_addr(id_priv); 764 mutex_unlock(&lock);
764 memcpy(&addr->sib_addr, &sgid, sizeof sgid); 765 addr = (struct sockaddr_ib *)cma_src_addr(id_priv);
766 memcpy(&addr->sib_addr, &sgid, sizeof(sgid));
765 cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr); 767 cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr);
766 return 0; 768 return 0;
767} 769}