linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-rc] rdma: Fix incorrectly handled NLA validation
@ 2018-12-30 13:34 Leon Romanovsky
  0 siblings, 0 replies; only message in thread
From: Leon Romanovsky @ 2018-12-30 13:34 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Leon Romanovsky, David Ahern, netdev, RDMA mailing list

From: Leon Romanovsky <leonro@mellanox.com>

mnl_attr_type_valid() receives maximum attribute type, which means that
we were supposed to supply the latest valid netlink attribute and not
the number of attributes. Such coding mistake caused to failures while
NLA attributes were extended.

Fixes: 74bd75c2b68d ("rdma: Add basic infrastructure for RDMA tool")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 rdma/utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rdma/utils.c b/rdma/utils.c
index 61f4aeb1..069d44fe 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -425,8 +425,8 @@ int rd_attr_cb(const struct nlattr *attr, void *data)
 	const struct nlattr **tb = data;
 	int type;

-	if (mnl_attr_type_valid(attr, RDMA_NLDEV_ATTR_MAX) < 0)
-		/* We received uknown attribute */
+	if (mnl_attr_type_valid(attr, RDMA_NLDEV_ATTR_MAX - 1) < 0)
+		/* We received unknown attribute */
 		return MNL_CB_OK;

 	type = mnl_attr_get_type(attr);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-30 13:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-30 13:34 [PATCH iproute2-rc] rdma: Fix incorrectly handled NLA validation Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).