Commit da71e66f authored by Mark Bloch's avatar Mark Bloch Committed by Ben Hutchings

IB/core: Fix a potential array overrun in CMA and SA agent

commit 2fa2d4fb upstream.

Fix array overrun when going over callback table.
In declaration of callback table, the max size isn't provided and
in registration phase, it is provided.

There is potential scenario where a new operation is added
and it is not supported by current client. The acceptance of
such operation by ib_netlink will cause to array overrun.

Fixes: 809d5fc9 ("infiniband: pass rdma_cm module to netlink_dump_start")
Fixes: b493d91d ("iwcm: common code for port mapper")
Fixes: 2ca546b9 ("IB/sa: Route SA pathrecord query through netlink")
Signed-off-by: default avatarMark Bloch <markb@mellanox.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
[bwh: Backported to 3.16:
 - Only cma.c needs to be fixed
 - Adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 6c1082d4
......@@ -3679,7 +3679,8 @@ static int __init cma_init(void)
if (ret)
goto err;
if (ibnl_add_client(RDMA_NL_RDMA_CM, RDMA_NL_RDMA_CM_NUM_OPS, cma_cb_table))
if (ibnl_add_client(RDMA_NL_RDMA_CM, ARRAY_SIZE(cma_cb_table),
cma_cb_table))
printk(KERN_WARNING "RDMA CMA: failed to add netlink callback\n");
return 0;
......
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