From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: [PATCH rdma-next V2 3/5] IB/core: Fix a potential array overrun in CMA and SA agent
Date: Fri, 6 May 2016 22:45:26 +0300 [thread overview]
Message-ID: <1462563928-29164-4-git-send-email-leon@kernel.org> (raw)
In-Reply-To: <1462563928-29164-1-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
From: Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
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: 809d5fc9bf65 ("infiniband: pass rdma_cm module to netlink_dump_start")
Fixes: b493d91d333e ("iwcm: common code for port mapper")
Fixes: 2ca546b92a02 ("IB/sa: Route SA pathrecord query through netlink")
Signed-off-by: Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/infiniband/core/cma.c | 3 ++-
drivers/infiniband/core/iwcm.c | 2 +-
drivers/infiniband/core/sa_query.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 93ab0ae..b575bd5 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -4294,7 +4294,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))
pr_warn("RDMA CMA: failed to add netlink callback\n");
cma_configfs_init();
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
index e28a160..51079e3 100644
--- a/drivers/infiniband/core/iwcm.c
+++ b/drivers/infiniband/core/iwcm.c
@@ -1175,7 +1175,7 @@ static int __init iw_cm_init(void)
if (ret)
pr_err("iw_cm: couldn't init iwpm\n");
- ret = ibnl_add_client(RDMA_NL_IWCM, RDMA_NL_IWPM_NUM_OPS,
+ ret = ibnl_add_client(RDMA_NL_IWCM, ARRAY_SIZE(iwcm_nl_cb_table),
iwcm_nl_cb_table);
if (ret)
pr_err("iw_cm: couldn't register netlink callbacks\n");
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 8a09c0f..1e7c652 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1820,7 +1820,7 @@ static int __init ib_sa_init(void)
goto err3;
}
- if (ibnl_add_client(RDMA_NL_LS, RDMA_NL_LS_NUM_OPS,
+ if (ibnl_add_client(RDMA_NL_LS, ARRAY_SIZE(ib_sa_cb_table),
ib_sa_cb_table)) {
pr_err("Failed to add netlink callback\n");
ret = -EINVAL;
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-05-06 19:45 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-06 19:45 [PATCH rdma-next V2 0/5] Trivial fixes for 4.7 Leon Romanovsky
[not found] ` <1462563928-29164-1-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-05-06 19:45 ` [PATCH rdma-next V2 1/5] IB/IWPM: Fix a potential skb leak Leon Romanovsky
2016-05-06 19:45 ` [PATCH rdma-next V2 2/5] IB/core: Remove unnecessary check in ibnl_rcv_msg Leon Romanovsky
2016-05-06 19:45 ` Leon Romanovsky [this message]
2016-05-06 19:45 ` [PATCH rdma-next V2 4/5] IB/SA: Use correct free function Leon Romanovsky
2016-05-06 19:45 ` [PATCH rdma-next V2 5/5] IB/core: Integrate IB address resolution module into core Leon Romanovsky
[not found] ` <1462563928-29164-6-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-05-13 19:34 ` Doug Ledford
[not found] ` <ea50f1d2-6f05-66f7-18f7-0a569fd9cea5-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-15 10:51 ` Mark Bloch
[not found] ` <VI1PR05MB1391AD099C536541E79A09F9D2760-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-16 15:09 ` Doug Ledford
[not found] ` <db369e8e-7993-dfb8-d459-2c4f3d6e5b14-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 16:30 ` Leon Romanovsky
[not found] ` <20160516163048.GB4662-2ukJVAZIZ/Y@public.gmane.org>
2016-05-16 17:42 ` Doug Ledford
[not found] ` <298657b0-6e57-745b-5eb3-001984bffbc3-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 18:27 ` Jason Gunthorpe
[not found] ` <20160516182743.GF7248-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-16 18:39 ` Doug Ledford
[not found] ` <5045d314-e2f5-bda6-5583-2212335593fd-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 4:41 ` Leon Romanovsky
[not found] ` <20160518044119.GH4662-2ukJVAZIZ/Y@public.gmane.org>
2016-05-18 14:20 ` Doug Ledford
2016-05-16 18:54 ` Leon Romanovsky
[not found] ` <20160516185434.GC4662-2ukJVAZIZ/Y@public.gmane.org>
2016-05-16 20:27 ` Doug Ledford
[not found] ` <82b21da8-8bec-a7ed-fc48-b7570c0aa4ce-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-16 21:03 ` Jason Gunthorpe
[not found] ` <20160516210327.GB10945-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-17 5:00 ` Mark Bloch
[not found] ` <VI1PR05MB1391FBF91190C84744581DB8D2480-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-17 16:56 ` Jason Gunthorpe
[not found] ` <20160517165647.GB19976-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-18 15:09 ` Mark Bloch
2016-05-17 5:46 ` Christoph Hellwig
[not found] ` <20160517054652.GA17101-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-05-17 5:51 ` Leon Romanovsky
2016-05-17 14:52 ` Doug Ledford
2016-05-17 5:48 ` Leon Romanovsky
[not found] ` <20160517054834.GD4662-2ukJVAZIZ/Y@public.gmane.org>
2016-05-17 14:58 ` Doug Ledford
[not found] ` <910c3e4c-2427-34c4-cc42-f8e951c7d157-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 4:47 ` Leon Romanovsky
[not found] ` <20160518044709.GI4662-2ukJVAZIZ/Y@public.gmane.org>
2016-05-18 14:20 ` Doug Ledford
2016-05-17 8:29 ` Mark Bloch
[not found] ` <VI1PR05MB13915036338162B126E55CC2D2480-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-17 15:48 ` Doug Ledford
[not found] ` <eea7049c-5a27-1498-8e8b-674d69468fbb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 6:43 ` Mark Bloch
[not found] ` <VI1PR05MB13910C6D09E0B6B9D477B1EAD2490-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-18 14:17 ` Doug Ledford
[not found] ` <d54c2884-c2e9-8952-75f8-43147943640c-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 14:26 ` Mark Bloch
[not found] ` <VI1PR05MB1391C3E551DDAEA3ABFE71FFD2490-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-18 14:51 ` Doug Ledford
[not found] ` <0558d12b-2646-63b4-89f8-9bf4aba689db-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 17:15 ` Jason Gunthorpe
[not found] ` <20160518171536.GB15170-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-05-18 17:58 ` Doug Ledford
[not found] ` <fe88d9cc-3d03-030d-c4c9-360ef0ce7067-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 18:28 ` Mark Bloch
[not found] ` <VI1PR05MB1391B1C6DFE620C31A6474A0D2490-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-18 18:42 ` Doug Ledford
[not found] ` <561a675d-89d2-e675-cf83-e86ecb7519b6-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-18 19:36 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E22EDE332-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-05-23 8:58 ` Leon Romanovsky
[not found] ` <20160523085809.GF25500-2ukJVAZIZ/Y@public.gmane.org>
2016-05-23 14:05 ` Doug Ledford
[not found] ` <57430E34.3090501-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-23 14:09 ` Mark Bloch
[not found] ` <VI1PR05MB13910E30E227D4DCDBC19033D24E0-79XLn2atqDP8GeyK7vyn2tqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-05-30 5:33 ` Knut Omang
[not found] ` <1464586394.13055.426.camel-6miFZF/5cTBuMpJDpNschA@public.gmane.org>
2016-05-30 6:33 ` Leon Romanovsky
[not found] ` <20160530063349.GA7477-2ukJVAZIZ/Y@public.gmane.org>
2016-05-30 11:37 ` Knut Omang
[not found] ` <1464608255.20967.27.camel-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-05-30 12:51 ` Leon Romanovsky
2016-05-13 19:22 ` [PATCH rdma-next V2 0/5] Trivial fixes for 4.7 Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462563928-29164-4-git-send-email-leon@kernel.org \
--to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.