aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-10-26 17:04:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-10-26 17:04:14 -0400
commit15f859ae5c43c7f0a064ed92d33f7a5bc5de6de0 (patch)
treedcbd05c2c1dff2d0ec32fc0f4ee1b24e3d9eb5ad
parent80c094a47dd4ea63375e3f60b5e076064f16e857 (diff)
parentb4d91aeb6e120b7e2f207021c31b914895c69bc4 (diff)
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
-rw-r--r--drivers/infiniband/core/netlink.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index b12e58787c3d..1fb72c356e36 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -175,13 +175,24 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
175 !netlink_capable(skb, CAP_NET_ADMIN)) 175 !netlink_capable(skb, CAP_NET_ADMIN))
176 return -EPERM; 176 return -EPERM;
177 177
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 }
178 /* FIXME: Convert IWCM to properly handle doit callbacks */ 187 /* FIXME: Convert IWCM to properly handle doit callbacks */
179 if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM || 188 if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM ||
180 index == RDMA_NL_IWCM) { 189 index == RDMA_NL_IWCM) {
181 struct netlink_dump_control c = { 190 struct netlink_dump_control c = {
182 .dump = cb_table[op].dump, 191 .dump = cb_table[op].dump,
183 }; 192 };
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;
185 } 196 }
186 197
187 if (cb_table[op].doit) 198 if (cb_table[op].doit)