Commit 9af3f5cf authored by Yuval Shaia's avatar Yuval Shaia Committed by Jason Gunthorpe

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: default avatarYuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent fe15bcc6
...@@ -1042,6 +1042,9 @@ int ib_enum_all_devs(nldev_callback nldev_cb, struct sk_buff *skb, ...@@ -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, int ib_query_pkey(struct ib_device *device,
u8 port_num, u16 index, u16 *pkey) 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); return device->query_pkey(device, port_num, index, pkey);
} }
EXPORT_SYMBOL(ib_query_pkey); EXPORT_SYMBOL(ib_query_pkey);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment