diff options
author | Yuval Shaia <yuval.shaia@oracle.com> | 2018-12-06 13:48:18 +0100 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-12-07 22:33:09 +0100 |
commit | 9af3f5cf9d64a056eca53bc643f6288ad28bbbb5 (patch) | |
tree | 59117acfb33c303971efcc368cd43f78e3bf654e /drivers | |
parent | Merge branch 'mlx5-packet-credit-fc' into rdma.git (diff) | |
download | linux-9af3f5cf9d64a056eca53bc643f6288ad28bbbb5.tar.xz linux-9af3f5cf9d64a056eca53bc643f6288ad28bbbb5.zip |
RDMA/core: Validate port number in query_pkey verb
Before calling the driver's function let's make sure port is valid.
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/core/device.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 0027b0d79b09..348a7fb1f945 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -1042,6 +1042,9 @@ int ib_enum_all_devs(nldev_callback nldev_cb, struct sk_buff *skb, 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); |