RDMA/nldev: Enforce device index check for port callback

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

Fixes: c3f66f7b0052 ("RDMA/netlink: Implement nldev port doit callback")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Doug Ledford <dledford@redhat.com>
[ Applying directly, since Doug fried his SSD's and is rebuilding - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Leon Romanovsky and committed by Linus Torvalds 287683d0 5f479447

Changed files
+3 -1
drivers
infiniband
core
+3 -1
drivers/infiniband/core/nldev.c
··· 214 214 215 215 err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, 216 216 nldev_policy, extack); 217 - if (err || !tb[RDMA_NLDEV_ATTR_PORT_INDEX]) 217 + if (err || 218 + !tb[RDMA_NLDEV_ATTR_DEV_INDEX] || 219 + !tb[RDMA_NLDEV_ATTR_PORT_INDEX]) 218 220 return -EINVAL; 219 221 220 222 index = nla_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);