Date: Wed, 12 Dec 2018 10:22:11 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r341860 - stable/11/sys/ofed/drivers/infiniband/core Message-ID: <201812121022.wBCAMBlV012308@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Wed Dec 12 10:22:10 2018 New Revision: 341860 URL: https://svnweb.freebsd.org/changeset/base/341860 Log: MFC r341523: ibcore: Don't access invalid port. The port number in the listen_id_priv has been observed to be zero which means no port has been selected. The current code lacks a check for invalid port number. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 12 10:21:10 2018 (r341859) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 12 10:22:10 2018 (r341860) @@ -621,16 +621,19 @@ static int cma_acquire_dev(struct rdma_id_private *id_ if (listen_id_priv) { cma_dev = listen_id_priv->cma_dev; port = listen_id_priv->id.port_num; - gidp = rdma_protocol_roce(cma_dev->device, port) ? - &iboe_gid : &gid; - ret = cma_validate_port(cma_dev->device, port, - rdma_protocol_ib(cma_dev->device, port) ? - IB_GID_TYPE_IB : - listen_id_priv->gid_type, gidp, dev_addr); - if (!ret) { - id_priv->id.port_num = port; - goto out; + if (rdma_is_port_valid(cma_dev->device, port)) { + gidp = rdma_protocol_roce(cma_dev->device, port) ? + &iboe_gid : &gid; + + ret = cma_validate_port(cma_dev->device, port, + rdma_protocol_ib(cma_dev->device, port) ? + IB_GID_TYPE_IB : + listen_id_priv->gid_type, gidp, dev_addr); + if (!ret) { + id_priv->id.port_num = port; + goto out; + } } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812121022.wBCAMBlV012308>