Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 287683d0 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Linus Torvalds
Browse files

RDMA/nldev: Enforce device index check for port callback



IB device index is nldev's handler and it should be checked always.

Fixes: c3f66f7b ("RDMA/netlink: Implement nldev port doit callback")
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Acked-by: default avatarDoug Ledford <dledford@redhat.com>
[ Applying directly, since Doug fried his SSD's and is rebuilding  - Linus ]
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5f479447
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -214,7 +214,9 @@ static int nldev_port_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,

	err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
			  nldev_policy, extack);
	if (err || !tb[RDMA_NLDEV_ATTR_PORT_INDEX])
	if (err ||
	    !tb[RDMA_NLDEV_ATTR_DEV_INDEX] ||
	    !tb[RDMA_NLDEV_ATTR_PORT_INDEX])
		return -EINVAL;

	index = nla_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);