aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154/nl-mac.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-19 18:50:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-19 18:50:47 -0500
commit1ee2dcc2245340cf4ac94b99c4d00efbeba61824 (patch)
tree5339e55add987379525177011dde6e3756b1430c /net/ieee802154/nl-mac.c
parent4457e6f6c9f6052cd5f44a79037108b5ddeb0ce7 (diff)
parent091e0662ee2c37867ad918ce7b6ddd17f0e090e2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: "Mostly these are fixes for fallout due to merge window changes, as well as cures for problems that have been with us for a much longer period of time" 1) Johannes Berg noticed two major deficiencies in our genetlink registration. Some genetlink protocols we passing in constant counts for their ops array rather than something like ARRAY_SIZE(ops) or similar. Also, some genetlink protocols were using fixed IDs for their multicast groups. We have to retain these fixed IDs to keep existing userland tools working, but reserve them so that other multicast groups used by other protocols can not possibly conflict. In dealing with these two problems, we actually now use less state management for genetlink operations and multicast groups. 2) When configuring interface hardware timestamping, fix several drivers that simply do not validate that the hwtstamp_config value is one the driver actually supports. From Ben Hutchings. 3) Invalid memory references in mwifiex driver, from Amitkumar Karwar. 4) In dev_forward_skb(), set the skb->protocol in the right order relative to skb_scrub_packet(). From Alexei Starovoitov. 5) Bridge erroneously fails to use the proper wrapper functions to make calls to netdev_ops->ndo_vlan_rx_{add,kill}_vid. Fix from Toshiaki Makita. 6) When detaching a bridge port, make sure to flush all VLAN IDs to prevent them from leaking, also from Toshiaki Makita. 7) Put in a compromise for TCP Small Queues so that deep queued devices that delay TX reclaim non-trivially don't have such a performance decrease. One particularly problematic area is 802.11 AMPDU in wireless. From Eric Dumazet. 8) Fix crashes in tcp_fastopen_cache_get(), we can see NULL socket dsts here. Fix from Eric Dumzaet, reported by Dave Jones. 9) Fix use after free in ipv6 SIT driver, from Willem de Bruijn. 10) When computing mergeable buffer sizes, virtio-net fails to take the virtio-net header into account. From Michael Dalton. 11) Fix seqlock deadlock in ip4_datagram_connect() wrt. statistic bumping, this one has been with us for a while. From Eric Dumazet. 12) Fix NULL deref in the new TIPC fragmentation handling, from Erik Hugne. 13) 6lowpan bit used for traffic classification was wrong, from Jukka Rissanen. 14) macvlan has the same issue as normal vlans did wrt. propagating LRO disabling down to the real device, fix it the same way. From Michal Kubecek. 15) CPSW driver needs to soft reset all slaves during suspend, from Daniel Mack. 16) Fix small frame pacing in FQ packet scheduler, from Eric Dumazet. 17) The xen-netfront RX buffer refill timer isn't properly scheduled on partial RX allocation success, from Ma JieYue. 18) When ipv6 ping protocol support was added, the AF_INET6 protocol initialization cleanup path on failure was borked a little. Fix from Vlad Yasevich. 19) If a socket disconnects during a read/recvmsg/recvfrom/etc that blocks we can do the wrong thing with the msg_name we write back to userspace. From Hannes Frederic Sowa. There is another fix in the works from Hannes which will prevent future problems of this nature. 20) Fix route leak in VTI tunnel transmit, from Fan Du. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (106 commits) genetlink: make multicast groups const, prevent abuse genetlink: pass family to functions using groups genetlink: add and use genl_set_err() genetlink: remove family pointer from genl_multicast_group genetlink: remove genl_unregister_mc_group() hsr: don't call genl_unregister_mc_group() quota/genetlink: use proper genetlink multicast APIs drop_monitor/genetlink: use proper genetlink multicast APIs genetlink: only pass array to genl_register_family_with_ops() tcp: don't update snd_nxt, when a socket is switched from repair mode atm: idt77252: fix dev refcnt leak xfrm: Release dst if this dst is improper for vti tunnel netlink: fix documentation typo in netlink_set_err() be2net: Delete secondary unicast MAC addresses during be_close be2net: Fix unconditional enabling of Rx interface options net, virtio_net: replace the magic value ping: prevent NULL pointer dereference on write to msg_name bnx2x: Prevent "timeout waiting for state X" bnx2x: prevent CFC attention bnx2x: Prevent panic during DMAE timeout ...
Diffstat (limited to 'net/ieee802154/nl-mac.c')
-rw-r--r--net/ieee802154/nl-mac.c79
1 files changed, 14 insertions, 65 deletions
diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
index b0bdd8c51e9c..ba5c1e002f37 100644
--- a/net/ieee802154/nl-mac.c
+++ b/net/ieee802154/nl-mac.c
@@ -39,14 +39,6 @@
39 39
40#include "ieee802154.h" 40#include "ieee802154.h"
41 41
42static struct genl_multicast_group ieee802154_coord_mcgrp = {
43 .name = IEEE802154_MCAST_COORD_NAME,
44};
45
46static struct genl_multicast_group ieee802154_beacon_mcgrp = {
47 .name = IEEE802154_MCAST_BEACON_NAME,
48};
49
50int ieee802154_nl_assoc_indic(struct net_device *dev, 42int ieee802154_nl_assoc_indic(struct net_device *dev,
51 struct ieee802154_addr *addr, u8 cap) 43 struct ieee802154_addr *addr, u8 cap)
52{ 44{
@@ -72,7 +64,7 @@ int ieee802154_nl_assoc_indic(struct net_device *dev,
72 nla_put_u8(msg, IEEE802154_ATTR_CAPABILITY, cap)) 64 nla_put_u8(msg, IEEE802154_ATTR_CAPABILITY, cap))
73 goto nla_put_failure; 65 goto nla_put_failure;
74 66
75 return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); 67 return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP);
76 68
77nla_put_failure: 69nla_put_failure:
78 nlmsg_free(msg); 70 nlmsg_free(msg);
@@ -98,7 +90,7 @@ int ieee802154_nl_assoc_confirm(struct net_device *dev, u16 short_addr,
98 nla_put_u16(msg, IEEE802154_ATTR_SHORT_ADDR, short_addr) || 90 nla_put_u16(msg, IEEE802154_ATTR_SHORT_ADDR, short_addr) ||
99 nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) 91 nla_put_u8(msg, IEEE802154_ATTR_STATUS, status))
100 goto nla_put_failure; 92 goto nla_put_failure;
101 return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); 93 return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP);
102 94
103nla_put_failure: 95nla_put_failure:
104 nlmsg_free(msg); 96 nlmsg_free(msg);
@@ -133,7 +125,7 @@ int ieee802154_nl_disassoc_indic(struct net_device *dev,
133 } 125 }
134 if (nla_put_u8(msg, IEEE802154_ATTR_REASON, reason)) 126 if (nla_put_u8(msg, IEEE802154_ATTR_REASON, reason))
135 goto nla_put_failure; 127 goto nla_put_failure;
136 return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); 128 return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP);
137 129
138nla_put_failure: 130nla_put_failure:
139 nlmsg_free(msg); 131 nlmsg_free(msg);
@@ -157,7 +149,7 @@ int ieee802154_nl_disassoc_confirm(struct net_device *dev, u8 status)
157 dev->dev_addr) || 149 dev->dev_addr) ||
158 nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) 150 nla_put_u8(msg, IEEE802154_ATTR_STATUS, status))
159 goto nla_put_failure; 151 goto nla_put_failure;
160 return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); 152 return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP);
161 153
162nla_put_failure: 154nla_put_failure:
163 nlmsg_free(msg); 155 nlmsg_free(msg);
@@ -183,7 +175,7 @@ int ieee802154_nl_beacon_indic(struct net_device *dev,
183 nla_put_u16(msg, IEEE802154_ATTR_COORD_SHORT_ADDR, coord_addr) || 175 nla_put_u16(msg, IEEE802154_ATTR_COORD_SHORT_ADDR, coord_addr) ||
184 nla_put_u16(msg, IEEE802154_ATTR_COORD_PAN_ID, panid)) 176 nla_put_u16(msg, IEEE802154_ATTR_COORD_PAN_ID, panid))
185 goto nla_put_failure; 177 goto nla_put_failure;
186 return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); 178 return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP);
187 179
188nla_put_failure: 180nla_put_failure:
189 nlmsg_free(msg); 181 nlmsg_free(msg);
@@ -214,7 +206,7 @@ int ieee802154_nl_scan_confirm(struct net_device *dev,
214 (edl && 206 (edl &&
215 nla_put(msg, IEEE802154_ATTR_ED_LIST, 27, edl))) 207 nla_put(msg, IEEE802154_ATTR_ED_LIST, 27, edl)))
216 goto nla_put_failure; 208 goto nla_put_failure;
217 return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); 209 return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP);
218 210
219nla_put_failure: 211nla_put_failure:
220 nlmsg_free(msg); 212 nlmsg_free(msg);
@@ -238,7 +230,7 @@ int ieee802154_nl_start_confirm(struct net_device *dev, u8 status)
238 dev->dev_addr) || 230 dev->dev_addr) ||
239 nla_put_u8(msg, IEEE802154_ATTR_STATUS, status)) 231 nla_put_u8(msg, IEEE802154_ATTR_STATUS, status))
240 goto nla_put_failure; 232 goto nla_put_failure;
241 return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id); 233 return ieee802154_nl_mcast(msg, IEEE802154_COORD_MCGRP);
242 234
243nla_put_failure: 235nla_put_failure:
244 nlmsg_free(msg); 236 nlmsg_free(msg);
@@ -309,8 +301,7 @@ static struct net_device *ieee802154_nl_get_dev(struct genl_info *info)
309 return dev; 301 return dev;
310} 302}
311 303
312static int ieee802154_associate_req(struct sk_buff *skb, 304int ieee802154_associate_req(struct sk_buff *skb, struct genl_info *info)
313 struct genl_info *info)
314{ 305{
315 struct net_device *dev; 306 struct net_device *dev;
316 struct ieee802154_addr addr; 307 struct ieee802154_addr addr;
@@ -357,8 +348,7 @@ out:
357 return ret; 348 return ret;
358} 349}
359 350
360static int ieee802154_associate_resp(struct sk_buff *skb, 351int ieee802154_associate_resp(struct sk_buff *skb, struct genl_info *info)
361 struct genl_info *info)
362{ 352{
363 struct net_device *dev; 353 struct net_device *dev;
364 struct ieee802154_addr addr; 354 struct ieee802154_addr addr;
@@ -390,8 +380,7 @@ out:
390 return ret; 380 return ret;
391} 381}
392 382
393static int ieee802154_disassociate_req(struct sk_buff *skb, 383int ieee802154_disassociate_req(struct sk_buff *skb, struct genl_info *info)
394 struct genl_info *info)
395{ 384{
396 struct net_device *dev; 385 struct net_device *dev;
397 struct ieee802154_addr addr; 386 struct ieee802154_addr addr;
@@ -433,7 +422,7 @@ out:
433 * PAN_coordinator, battery_life_extension = 0, 422 * PAN_coordinator, battery_life_extension = 0,
434 * coord_realignment = 0, security_enable = 0 423 * coord_realignment = 0, security_enable = 0
435*/ 424*/
436static int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info) 425int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info)
437{ 426{
438 struct net_device *dev; 427 struct net_device *dev;
439 struct ieee802154_addr addr; 428 struct ieee802154_addr addr;
@@ -492,7 +481,7 @@ out:
492 return ret; 481 return ret;
493} 482}
494 483
495static int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info) 484int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info)
496{ 485{
497 struct net_device *dev; 486 struct net_device *dev;
498 int ret = -EOPNOTSUPP; 487 int ret = -EOPNOTSUPP;
@@ -530,8 +519,7 @@ out:
530 return ret; 519 return ret;
531} 520}
532 521
533static int ieee802154_list_iface(struct sk_buff *skb, 522int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info)
534 struct genl_info *info)
535{ 523{
536 /* Request for interface name, index, type, IEEE address, 524 /* Request for interface name, index, type, IEEE address,
537 PAN Id, short address */ 525 PAN Id, short address */
@@ -565,8 +553,7 @@ out_dev:
565 553
566} 554}
567 555
568static int ieee802154_dump_iface(struct sk_buff *skb, 556int ieee802154_dump_iface(struct sk_buff *skb, struct netlink_callback *cb)
569 struct netlink_callback *cb)
570{ 557{
571 struct net *net = sock_net(skb->sk); 558 struct net *net = sock_net(skb->sk);
572 struct net_device *dev; 559 struct net_device *dev;
@@ -590,41 +577,3 @@ cont:
590 577
591 return skb->len; 578 return skb->len;
592} 579}
593
594static struct genl_ops ieee802154_coordinator_ops[] = {
595 IEEE802154_OP(IEEE802154_ASSOCIATE_REQ, ieee802154_associate_req),
596 IEEE802154_OP(IEEE802154_ASSOCIATE_RESP, ieee802154_associate_resp),
597 IEEE802154_OP(IEEE802154_DISASSOCIATE_REQ, ieee802154_disassociate_req),
598 IEEE802154_OP(IEEE802154_SCAN_REQ, ieee802154_scan_req),
599 IEEE802154_OP(IEEE802154_START_REQ, ieee802154_start_req),
600 IEEE802154_DUMP(IEEE802154_LIST_IFACE, ieee802154_list_iface,
601 ieee802154_dump_iface),
602};
603
604/*
605 * No need to unregister as family unregistration will do it.
606 */
607int nl802154_mac_register(void)
608{
609 int i;
610 int rc;
611
612 rc = genl_register_mc_group(&nl802154_family,
613 &ieee802154_coord_mcgrp);
614 if (rc)
615 return rc;
616
617 rc = genl_register_mc_group(&nl802154_family,
618 &ieee802154_beacon_mcgrp);
619 if (rc)
620 return rc;
621
622 for (i = 0; i < ARRAY_SIZE(ieee802154_coordinator_ops); i++) {
623 rc = genl_register_ops(&nl802154_family,
624 &ieee802154_coordinator_ops[i]);
625 if (rc)
626 return rc;
627 }
628
629 return 0;
630}