Skip to content

Commit 287683d

Browse files
Leon Romanovskytorvalds
authored andcommitted
RDMA/nldev: Enforce device index check for port callback
IB device index is nldev's handler and it should be checked always. Fixes: c3f66f7 ("RDMA/netlink: Implement nldev port doit callback") Signed-off-by: Leon Romanovsky <[email protected]> Acked-by: Doug Ledford <[email protected]> [ Applying directly, since Doug fried his SSD's and is rebuilding - Linus ] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 5f47944 commit 287683d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/infiniband/core/nldev.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ static int nldev_port_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
214214

215215
err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
216216
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])
218220
return -EINVAL;
219221

220222
index = nla_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);

0 commit comments

Comments
 (0)