Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jul 2021 13:09:36 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 31525faed8b4 - main - ibcore: Validate port number in query_pkey verb.
Message-ID:  <202107121309.16CD9adj094998@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=31525faed8b43c579767cf3ac211f41764b2a46c

commit 31525faed8b43c579767cf3ac211f41764b2a46c
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-06-16 13:01:42 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2021-07-12 12:22:31 +0000

    ibcore: Validate port number in query_pkey verb.
    
    Before calling the driver's function let's make sure port is valid.
    
    Linux commit:
    9af3f5cf9d64a056eca53bc643f6288ad28bbbb5
    
    MFC after:      1 week
    Reviewed by:    kib
    Sponsored by:   Mellanox Technologies // NVIDIA Networking
---
 sys/ofed/drivers/infiniband/core/ib_device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/ofed/drivers/infiniband/core/ib_device.c b/sys/ofed/drivers/infiniband/core/ib_device.c
index 8c6a2d9f1a8a..8ce1127db639 100644
--- a/sys/ofed/drivers/infiniband/core/ib_device.c
+++ b/sys/ofed/drivers/infiniband/core/ib_device.c
@@ -809,6 +809,9 @@ void ib_cache_gid_del_all_by_netdev(struct ifnet *ndev)
 int ib_query_pkey(struct ib_device *device,
 		  u8 port_num, u16 index, u16 *pkey)
 {
+	if (!rdma_is_port_valid(device, port_num))
+		return -EINVAL;
+
 	return device->query_pkey(device, port_num, index, pkey);
 }
 EXPORT_SYMBOL(ib_query_pkey);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107121309.16CD9adj094998>