Skip to content

Commit 15f859a

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Pull rdma fix from Doug Ledford: "Fix an oops issue in the new RDMA netlink code" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: RDMA/netlink: OOPs in rdma_nl_rcv_msg() from misinterpreted flag
2 parents 80c094a + b4d91ae commit 15f859a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/infiniband/core/netlink.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,24 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
175175
!netlink_capable(skb, CAP_NET_ADMIN))
176176
return -EPERM;
177177

178+
/*
179+
* LS responses overload the 0x100 (NLM_F_ROOT) flag. Don't
180+
* mistakenly call the .dump() function.
181+
*/
182+
if (index == RDMA_NL_LS) {
183+
if (cb_table[op].doit)
184+
return cb_table[op].doit(skb, nlh, extack);
185+
return -EINVAL;
186+
}
178187
/* FIXME: Convert IWCM to properly handle doit callbacks */
179188
if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM ||
180189
index == RDMA_NL_IWCM) {
181190
struct netlink_dump_control c = {
182191
.dump = cb_table[op].dump,
183192
};
184-
return netlink_dump_start(nls, skb, nlh, &c);
193+
if (c.dump)
194+
return netlink_dump_start(nls, skb, nlh, &c);
195+
return -EINVAL;
185196
}
186197

187198
if (cb_table[op].doit)

0 commit comments

Comments
 (0)