aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-04-03 01:35:23 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-03 01:35:23 -0400
commite1ec1b8ccdf0df6000faa8c2d985ca5f94157e5a (patch)
tree4e1ca325dde22f1ac21c9da0be509e87e922e604 /net
parentc0f39322c335412339dec16ebfd2a05ceba5ebcf (diff)
parent802fb176d8c635ae42da31b80841c26e8c7338a0 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/s2io.c
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan.c20
-rw-r--r--net/8021q/vlan.h5
-rw-r--r--net/8021q/vlanproc.c5
-rw-r--r--net/bluetooth/af_bluetooth.c40
-rw-r--r--net/bluetooth/hci_sock.c2
-rw-r--r--net/bluetooth/l2cap.c2
-rw-r--r--net/bluetooth/rfcomm/core.c2
-rw-r--r--net/bluetooth/rfcomm/sock.c2
-rw-r--r--net/bluetooth/rfcomm/tty.c5
-rw-r--r--net/bluetooth/sco.c2
-rw-r--r--net/ipv4/inet_fragment.c3
-rw-r--r--net/ipv4/ip_forward.c2
-rw-r--r--net/ipv4/udp.c4
-rw-r--r--net/ipv6/addrconf.c19
-rw-r--r--net/ipv6/icmp.c4
-rw-r--r--net/ipv6/ip6_input.c3
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c2
-rw-r--r--net/llc/af_llc.c3
-rw-r--r--net/llc/llc_c_ac.c47
-rw-r--r--net/llc/llc_core.c9
-rw-r--r--net/llc/llc_input.c6
-rw-r--r--net/llc/llc_pdu.c2
-rw-r--r--net/llc/llc_s_ac.c9
-rw-r--r--net/llc/llc_sap.c27
-rw-r--r--net/llc/llc_station.c19
-rw-r--r--net/mac80211/ieee80211.c12
-rw-r--r--net/mac80211/ieee80211_sta.c9
-rw-r--r--net/rose/af_rose.c9
-rw-r--r--net/sched/sch_generic.c18
29 files changed, 218 insertions, 74 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 694be86e4490..5975ec3be7f3 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -384,17 +384,35 @@ static void vlan_sync_address(struct net_device *dev,
384 memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN); 384 memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN);
385} 385}
386 386
387static void __vlan_device_event(struct net_device *dev, unsigned long event)
388{
389 switch (event) {
390 case NETDEV_CHANGENAME:
391 vlan_proc_rem_dev(dev);
392 if (vlan_proc_add_dev(dev) < 0)
393 pr_warning("8021q: failed to change proc name for %s\n",
394 dev->name);
395 break;
396 }
397}
398
387static int vlan_device_event(struct notifier_block *unused, unsigned long event, 399static int vlan_device_event(struct notifier_block *unused, unsigned long event,
388 void *ptr) 400 void *ptr)
389{ 401{
390 struct net_device *dev = ptr; 402 struct net_device *dev = ptr;
391 struct vlan_group *grp = __vlan_find_group(dev->ifindex); 403 struct vlan_group *grp;
392 int i, flgs; 404 int i, flgs;
393 struct net_device *vlandev; 405 struct net_device *vlandev;
394 406
395 if (dev_net(dev) != &init_net) 407 if (dev_net(dev) != &init_net)
396 return NOTIFY_DONE; 408 return NOTIFY_DONE;
397 409
410 if (is_vlan_dev(dev)) {
411 __vlan_device_event(dev, event);
412 goto out;
413 }
414
415 grp = __vlan_find_group(dev->ifindex);
398 if (!grp) 416 if (!grp)
399 goto out; 417 goto out;
400 418
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 73efcc715ccb..51271aea402b 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -45,4 +45,9 @@ void vlan_netlink_fini(void);
45 45
46extern struct rtnl_link_ops vlan_link_ops; 46extern struct rtnl_link_ops vlan_link_ops;
47 47
48static inline int is_vlan_dev(struct net_device *dev)
49{
50 return dev->priv_flags & IFF_802_1Q_VLAN;
51}
52
48#endif /* !(__BEN_VLAN_802_1Q_INC__) */ 53#endif /* !(__BEN_VLAN_802_1Q_INC__) */
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index 3b8657a0b837..24cd96ee8109 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -210,11 +210,6 @@ int vlan_proc_rem_dev(struct net_device *vlandev)
210 * The following few functions build the content of /proc/net/vlan/config 210 * The following few functions build the content of /proc/net/vlan/config
211 */ 211 */
212 212
213static inline int is_vlan_dev(struct net_device *dev)
214{
215 return dev->priv_flags & IFF_802_1Q_VLAN;
216}
217
218/* start read of /proc/net/vlan/config */ 213/* start read of /proc/net/vlan/config */
219static void *vlan_seq_start(struct seq_file *seq, loff_t *pos) 214static void *vlan_seq_start(struct seq_file *seq, loff_t *pos)
220 __acquires(dev_base_lock) 215 __acquires(dev_base_lock)
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 1220d8a41eb5..d366423c8392 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -53,6 +53,30 @@
53/* Bluetooth sockets */ 53/* Bluetooth sockets */
54#define BT_MAX_PROTO 8 54#define BT_MAX_PROTO 8
55static struct net_proto_family *bt_proto[BT_MAX_PROTO]; 55static struct net_proto_family *bt_proto[BT_MAX_PROTO];
56
57static struct lock_class_key bt_slock_key[BT_MAX_PROTO];
58static struct lock_class_key bt_lock_key[BT_MAX_PROTO];
59static const char *bt_key_strings[BT_MAX_PROTO] = {
60 "sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP",
61 "sk_lock-AF_BLUETOOTH-BTPROTO_HCI",
62 "sk_lock-AF_BLUETOOTH-BTPROTO_SCO",
63 "sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM",
64 "sk_lock-AF_BLUETOOTH-BTPROTO_BNEP",
65 "sk_lock-AF_BLUETOOTH-BTPROTO_CMTP",
66 "sk_lock-AF_BLUETOOTH-BTPROTO_HIDP",
67 "sk_lock-AF_BLUETOOTH-BTPROTO_AVDTP",
68};
69
70static const char *bt_slock_key_strings[BT_MAX_PROTO] = {
71 "slock-AF_BLUETOOTH-BTPROTO_L2CAP",
72 "slock-AF_BLUETOOTH-BTPROTO_HCI",
73 "slock-AF_BLUETOOTH-BTPROTO_SCO",
74 "slock-AF_BLUETOOTH-BTPROTO_RFCOMM",
75 "slock-AF_BLUETOOTH-BTPROTO_BNEP",
76 "slock-AF_BLUETOOTH-BTPROTO_CMTP",
77 "slock-AF_BLUETOOTH-BTPROTO_HIDP",
78 "slock-AF_BLUETOOTH-BTPROTO_AVDTP",
79};
56static DEFINE_RWLOCK(bt_proto_lock); 80static DEFINE_RWLOCK(bt_proto_lock);
57 81
58int bt_sock_register(int proto, struct net_proto_family *ops) 82int bt_sock_register(int proto, struct net_proto_family *ops)
@@ -95,6 +119,21 @@ int bt_sock_unregister(int proto)
95} 119}
96EXPORT_SYMBOL(bt_sock_unregister); 120EXPORT_SYMBOL(bt_sock_unregister);
97 121
122static void bt_reclassify_sock_lock(struct socket *sock, int proto)
123{
124 struct sock *sk = sock->sk;
125
126 if (!sk)
127 return;
128 BUG_ON(sock_owned_by_user(sk));
129
130 sock_lock_init_class_and_name(sk,
131 bt_slock_key_strings[proto],
132 &bt_slock_key[proto],
133 bt_key_strings[proto],
134 &bt_lock_key[proto]);
135}
136
98static int bt_sock_create(struct net *net, struct socket *sock, int proto) 137static int bt_sock_create(struct net *net, struct socket *sock, int proto)
99{ 138{
100 int err; 139 int err;
@@ -117,6 +156,7 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto)
117 156
118 if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { 157 if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
119 err = bt_proto[proto]->create(net, sock, proto); 158 err = bt_proto[proto]->create(net, sock, proto);
159 bt_reclassify_sock_lock(sock, proto);
120 module_put(bt_proto[proto]->owner); 160 module_put(bt_proto[proto]->owner);
121 } 161 }
122 162
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index b5d4019d3572..1d36c093523b 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -84,7 +84,7 @@ static struct hci_sec_filter hci_sec_filter = {
84}; 84};
85 85
86static struct bt_sock_list hci_sk_list = { 86static struct bt_sock_list hci_sk_list = {
87 .lock = RW_LOCK_UNLOCKED 87 .lock = __RW_LOCK_UNLOCKED(hci_sk_list.lock)
88}; 88};
89 89
90/* Send frame to RAW socket */ 90/* Send frame to RAW socket */
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 6b995ac832f5..a4849f2c1d81 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -62,7 +62,7 @@ static u32 l2cap_feat_mask = 0x0000;
62static const struct proto_ops l2cap_sock_ops; 62static const struct proto_ops l2cap_sock_ops;
63 63
64static struct bt_sock_list l2cap_sk_list = { 64static struct bt_sock_list l2cap_sk_list = {
65 .lock = RW_LOCK_UNLOCKED 65 .lock = __RW_LOCK_UNLOCKED(l2cap_sk_list.lock)
66}; 66};
67 67
68static void __l2cap_sock_close(struct sock *sk, int reason); 68static void __l2cap_sock_close(struct sock *sk, int reason);
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 0c2c93735e93..eb62558e9b09 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -423,8 +423,8 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
423 423
424 rfcomm_dlc_lock(d); 424 rfcomm_dlc_lock(d);
425 d->state = BT_CLOSED; 425 d->state = BT_CLOSED;
426 d->state_change(d, err);
427 rfcomm_dlc_unlock(d); 426 rfcomm_dlc_unlock(d);
427 d->state_change(d, err);
428 428
429 skb_queue_purge(&d->tx_queue); 429 skb_queue_purge(&d->tx_queue);
430 rfcomm_dlc_unlink(d); 430 rfcomm_dlc_unlink(d);
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index c103fa02893b..5083adcbfae5 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -60,7 +60,7 @@
60static const struct proto_ops rfcomm_sock_ops; 60static const struct proto_ops rfcomm_sock_ops;
61 61
62static struct bt_sock_list rfcomm_sk_list = { 62static struct bt_sock_list rfcomm_sk_list = {
63 .lock = RW_LOCK_UNLOCKED 63 .lock = __RW_LOCK_UNLOCKED(rfcomm_sk_list.lock)
64}; 64};
65 65
66static void rfcomm_sock_close(struct sock *sk); 66static void rfcomm_sock_close(struct sock *sk);
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index e4c779bb8d76..c3f749abb2d0 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -570,12 +570,7 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err)
570 return; 570 return;
571 571
572 rfcomm_dev_del(dev); 572 rfcomm_dev_del(dev);
573 /* We have to drop DLC lock here, otherwise
574 rfcomm_dev_put() will dead lock if it's
575 the last reference. */
576 rfcomm_dlc_unlock(dlc);
577 rfcomm_dev_put(dev); 573 rfcomm_dev_put(dev);
578 rfcomm_dlc_lock(dlc);
579 } 574 }
580 } else 575 } else
581 tty_hangup(dev->tty); 576 tty_hangup(dev->tty);
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 2a5953b4405d..b0d487e2db20 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -58,7 +58,7 @@
58static const struct proto_ops sco_sock_ops; 58static const struct proto_ops sco_sock_ops;
59 59
60static struct bt_sock_list sco_sk_list = { 60static struct bt_sock_list sco_sk_list = {
61 .lock = RW_LOCK_UNLOCKED 61 .lock = __RW_LOCK_UNLOCKED(sco_sk_list.lock)
62}; 62};
63 63
64static void __sco_chan_add(struct sco_conn *conn, struct sock *sk, struct sock *parent); 64static void __sco_chan_add(struct sco_conn *conn, struct sock *sk, struct sock *parent);
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 93170bfcc22e..4ed429bd5951 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -86,7 +86,10 @@ EXPORT_SYMBOL(inet_frags_fini);
86void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f) 86void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f)
87{ 87{
88 nf->low_thresh = 0; 88 nf->low_thresh = 0;
89
90 local_bh_disable();
89 inet_frag_evictor(nf, f); 91 inet_frag_evictor(nf, f);
92 local_bh_enable();
90} 93}
91EXPORT_SYMBOL(inet_frags_exit_net); 94EXPORT_SYMBOL(inet_frags_exit_net);
92 95
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 9d6d3befd854..4813c39b438b 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -85,7 +85,7 @@ int ip_forward(struct sk_buff *skb)
85 if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway) 85 if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
86 goto sr_failed; 86 goto sr_failed;
87 87
88 if (unlikely(skb->len > dst_mtu(&rt->u.dst) && 88 if (unlikely(skb->len > dst_mtu(&rt->u.dst) && !skb_is_gso(skb) &&
89 (ip_hdr(skb)->frag_off & htons(IP_DF))) && !skb->local_df) { 89 (ip_hdr(skb)->frag_off & htons(IP_DF))) && !skb->local_df) {
90 IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); 90 IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
91 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, 91 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 03bd70697481..7b7fcacec4a0 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1551,14 +1551,14 @@ static void *udp_seq_start(struct seq_file *seq, loff_t *pos)
1551 __acquires(udp_hash_lock) 1551 __acquires(udp_hash_lock)
1552{ 1552{
1553 read_lock(&udp_hash_lock); 1553 read_lock(&udp_hash_lock);
1554 return *pos ? udp_get_idx(seq, *pos-1) : (void *)1; 1554 return *pos ? udp_get_idx(seq, *pos-1) : SEQ_START_TOKEN;
1555} 1555}
1556 1556
1557static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos) 1557static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1558{ 1558{
1559 struct sock *sk; 1559 struct sock *sk;
1560 1560
1561 if (v == (void *)1) 1561 if (v == SEQ_START_TOKEN)
1562 sk = udp_get_idx(seq, 0); 1562 sk = udp_get_idx(seq, 0);
1563 else 1563 else
1564 sk = udp_get_next(seq, v); 1564 sk = udp_get_next(seq, v);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5ab9973571ef..87f688857ade 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -776,6 +776,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i
776 struct inet6_dev *idev = ifp->idev; 776 struct inet6_dev *idev = ifp->idev;
777 struct in6_addr addr, *tmpaddr; 777 struct in6_addr addr, *tmpaddr;
778 unsigned long tmp_prefered_lft, tmp_valid_lft, tmp_cstamp, tmp_tstamp; 778 unsigned long tmp_prefered_lft, tmp_valid_lft, tmp_cstamp, tmp_tstamp;
779 unsigned long regen_advance;
779 int tmp_plen; 780 int tmp_plen;
780 int ret = 0; 781 int ret = 0;
781 int max_addresses; 782 int max_addresses;
@@ -836,8 +837,23 @@ retry:
836 tmp_tstamp = ifp->tstamp; 837 tmp_tstamp = ifp->tstamp;
837 spin_unlock_bh(&ifp->lock); 838 spin_unlock_bh(&ifp->lock);
838 839
840 regen_advance = idev->cnf.regen_max_retry *
841 idev->cnf.dad_transmits *
842 idev->nd_parms->retrans_time / HZ;
839 write_unlock(&idev->lock); 843 write_unlock(&idev->lock);
840 844
845 /* A temporary address is created only if this calculated Preferred
846 * Lifetime is greater than REGEN_ADVANCE time units. In particular,
847 * an implementation must not create a temporary address with a zero
848 * Preferred Lifetime.
849 */
850 if (tmp_prefered_lft <= regen_advance) {
851 in6_ifa_put(ifp);
852 in6_dev_put(idev);
853 ret = -1;
854 goto out;
855 }
856
841 addr_flags = IFA_F_TEMPORARY; 857 addr_flags = IFA_F_TEMPORARY;
842 /* set in addrconf_prefix_rcv() */ 858 /* set in addrconf_prefix_rcv() */
843 if (ifp->flags & IFA_F_OPTIMISTIC) 859 if (ifp->flags & IFA_F_OPTIMISTIC)
@@ -1834,6 +1850,9 @@ ok:
1834 * lifetimes of an existing temporary address 1850 * lifetimes of an existing temporary address
1835 * when processing a Prefix Information Option. 1851 * when processing a Prefix Information Option.
1836 */ 1852 */
1853 if (ifp != ift->ifpub)
1854 continue;
1855
1837 spin_lock(&ift->lock); 1856 spin_lock(&ift->lock);
1838 flags = ift->flags; 1857 flags = ift->flags;
1839 if (ift->valid_lft > valid_lft && 1858 if (ift->valid_lft > valid_lft &&
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 63309d10df3a..227ce3d2339d 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -440,10 +440,10 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
440 } 440 }
441 441
442 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6)) 442 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6))
443 goto out; 443 goto out_dst_release;
444 444
445 if (ip6_dst_lookup(sk, &dst2, &fl)) 445 if (ip6_dst_lookup(sk, &dst2, &fl))
446 goto out; 446 goto out_dst_release;
447 447
448 err = xfrm_lookup(&dst2, &fl, sk, XFRM_LOOKUP_ICMP); 448 err = xfrm_lookup(&dst2, &fl, sk, XFRM_LOOKUP_ICMP);
449 if (err == -ENOENT) { 449 if (err == -ENOENT) {
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 7e36269826ba..43a617e2268b 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -234,8 +234,7 @@ int ip6_mc_input(struct sk_buff *skb)
234 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS); 234 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS);
235 235
236 hdr = ipv6_hdr(skb); 236 hdr = ipv6_hdr(skb);
237 deliver = unlikely(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI)) || 237 deliver = ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL);
238 ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL);
239 238
240 /* 239 /*
241 * IPv6 multicast router mode isnt currently supported. 240 * IPv6 multicast router mode isnt currently supported.
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index ad8066200f9d..9e5f305b2022 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -171,7 +171,9 @@ static __inline__ void fq_kill(struct nf_ct_frag6_queue *fq)
171 171
172static void nf_ct_frag6_evictor(void) 172static void nf_ct_frag6_evictor(void)
173{ 173{
174 local_bh_disable();
174 inet_frag_evictor(&nf_init_frags, &nf_frags); 175 inet_frag_evictor(&nf_init_frags, &nf_frags);
176 local_bh_enable();
175} 177}
176 178
177static void nf_ct_frag6_expire(unsigned long data) 179static void nf_ct_frag6_expire(unsigned long data)
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index f93b57618582..97101dcde4c0 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -155,6 +155,9 @@ static int llc_ui_create(struct net *net, struct socket *sock, int protocol)
155 struct sock *sk; 155 struct sock *sk;
156 int rc = -ESOCKTNOSUPPORT; 156 int rc = -ESOCKTNOSUPPORT;
157 157
158 if (!capable(CAP_NET_RAW))
159 return -EPERM;
160
158 if (net != &init_net) 161 if (net != &init_net)
159 return -EAFNOSUPPORT; 162 return -EAFNOSUPPORT;
160 163
diff --git a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c
index f728ffe288aa..019c780512e8 100644
--- a/net/llc/llc_c_ac.c
+++ b/net/llc/llc_c_ac.c
@@ -198,7 +198,7 @@ int llc_conn_ac_send_disc_cmd_p_set_x(struct sock *sk, struct sk_buff *skb)
198{ 198{
199 int rc = -ENOBUFS; 199 int rc = -ENOBUFS;
200 struct llc_sock *llc = llc_sk(sk); 200 struct llc_sock *llc = llc_sk(sk);
201 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 201 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_U, 0);
202 202
203 if (nskb) { 203 if (nskb) {
204 struct llc_sap *sap = llc->sap; 204 struct llc_sap *sap = llc->sap;
@@ -223,7 +223,7 @@ int llc_conn_ac_send_dm_rsp_f_set_p(struct sock *sk, struct sk_buff *skb)
223{ 223{
224 int rc = -ENOBUFS; 224 int rc = -ENOBUFS;
225 struct llc_sock *llc = llc_sk(sk); 225 struct llc_sock *llc = llc_sk(sk);
226 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 226 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_U, 0);
227 227
228 if (nskb) { 228 if (nskb) {
229 struct llc_sap *sap = llc->sap; 229 struct llc_sap *sap = llc->sap;
@@ -249,7 +249,7 @@ int llc_conn_ac_send_dm_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
249{ 249{
250 int rc = -ENOBUFS; 250 int rc = -ENOBUFS;
251 struct llc_sock *llc = llc_sk(sk); 251 struct llc_sock *llc = llc_sk(sk);
252 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 252 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_U, 0);
253 253
254 if (nskb) { 254 if (nskb) {
255 struct llc_sap *sap = llc->sap; 255 struct llc_sap *sap = llc->sap;
@@ -282,7 +282,8 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, struct sk_buff *skb)
282 llc_pdu_decode_pf_bit(skb, &f_bit); 282 llc_pdu_decode_pf_bit(skb, &f_bit);
283 else 283 else
284 f_bit = 0; 284 f_bit = 0;
285 nskb = llc_alloc_frame(sk, llc->dev); 285 nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_U,
286 sizeof(struct llc_frmr_info));
286 if (nskb) { 287 if (nskb) {
287 struct llc_sap *sap = llc->sap; 288 struct llc_sap *sap = llc->sap;
288 289
@@ -306,7 +307,8 @@ int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock *sk, struct sk_buff *skb)
306{ 307{
307 int rc = -ENOBUFS; 308 int rc = -ENOBUFS;
308 struct llc_sock *llc = llc_sk(sk); 309 struct llc_sock *llc = llc_sk(sk);
309 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 310 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_U,
311 sizeof(struct llc_frmr_info));
310 312
311 if (nskb) { 313 if (nskb) {
312 struct llc_sap *sap = llc->sap; 314 struct llc_sap *sap = llc->sap;
@@ -336,7 +338,8 @@ int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock *sk, struct sk_buff *skb)
336 struct llc_sock *llc = llc_sk(sk); 338 struct llc_sock *llc = llc_sk(sk);
337 339
338 llc_pdu_decode_pf_bit(skb, &f_bit); 340 llc_pdu_decode_pf_bit(skb, &f_bit);
339 nskb = llc_alloc_frame(sk, llc->dev); 341 nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_U,
342 sizeof(struct llc_frmr_info));
340 if (nskb) { 343 if (nskb) {
341 struct llc_sap *sap = llc->sap; 344 struct llc_sap *sap = llc->sap;
342 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 345 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
@@ -424,7 +427,7 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk,
424 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); 427 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
425 int rc = -ENOBUFS; 428 int rc = -ENOBUFS;
426 struct llc_sock *llc = llc_sk(sk); 429 struct llc_sock *llc = llc_sk(sk);
427 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 430 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_U, 0);
428 431
429 if (nskb) { 432 if (nskb) {
430 struct llc_sap *sap = llc->sap; 433 struct llc_sap *sap = llc->sap;
@@ -459,7 +462,7 @@ int llc_conn_ac_send_rej_cmd_p_set_1(struct sock *sk, struct sk_buff *skb)
459{ 462{
460 int rc = -ENOBUFS; 463 int rc = -ENOBUFS;
461 struct llc_sock *llc = llc_sk(sk); 464 struct llc_sock *llc = llc_sk(sk);
462 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 465 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
463 466
464 if (nskb) { 467 if (nskb) {
465 struct llc_sap *sap = llc->sap; 468 struct llc_sap *sap = llc->sap;
@@ -483,7 +486,7 @@ int llc_conn_ac_send_rej_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
483{ 486{
484 int rc = -ENOBUFS; 487 int rc = -ENOBUFS;
485 struct llc_sock *llc = llc_sk(sk); 488 struct llc_sock *llc = llc_sk(sk);
486 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 489 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
487 490
488 if (nskb) { 491 if (nskb) {
489 struct llc_sap *sap = llc->sap; 492 struct llc_sap *sap = llc->sap;
@@ -507,7 +510,7 @@ int llc_conn_ac_send_rej_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
507{ 510{
508 int rc = -ENOBUFS; 511 int rc = -ENOBUFS;
509 struct llc_sock *llc = llc_sk(sk); 512 struct llc_sock *llc = llc_sk(sk);
510 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 513 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
511 514
512 if (nskb) { 515 if (nskb) {
513 struct llc_sap *sap = llc->sap; 516 struct llc_sap *sap = llc->sap;
@@ -531,7 +534,7 @@ int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb)
531{ 534{
532 int rc = -ENOBUFS; 535 int rc = -ENOBUFS;
533 struct llc_sock *llc = llc_sk(sk); 536 struct llc_sock *llc = llc_sk(sk);
534 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 537 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
535 538
536 if (nskb) { 539 if (nskb) {
537 struct llc_sap *sap = llc->sap; 540 struct llc_sap *sap = llc->sap;
@@ -555,7 +558,7 @@ int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
555{ 558{
556 int rc = -ENOBUFS; 559 int rc = -ENOBUFS;
557 struct llc_sock *llc = llc_sk(sk); 560 struct llc_sock *llc = llc_sk(sk);
558 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 561 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
559 562
560 if (nskb) { 563 if (nskb) {
561 struct llc_sap *sap = llc->sap; 564 struct llc_sap *sap = llc->sap;
@@ -579,7 +582,7 @@ int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
579{ 582{
580 int rc = -ENOBUFS; 583 int rc = -ENOBUFS;
581 struct llc_sock *llc = llc_sk(sk); 584 struct llc_sock *llc = llc_sk(sk);
582 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 585 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
583 586
584 if (nskb) { 587 if (nskb) {
585 struct llc_sap *sap = llc->sap; 588 struct llc_sap *sap = llc->sap;
@@ -615,7 +618,7 @@ int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
615{ 618{
616 int rc = -ENOBUFS; 619 int rc = -ENOBUFS;
617 struct llc_sock *llc = llc_sk(sk); 620 struct llc_sock *llc = llc_sk(sk);
618 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 621 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
619 622
620 if (nskb) { 623 if (nskb) {
621 struct llc_sap *sap = llc->sap; 624 struct llc_sap *sap = llc->sap;
@@ -639,7 +642,7 @@ int llc_conn_ac_send_rr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb)
639{ 642{
640 int rc = -ENOBUFS; 643 int rc = -ENOBUFS;
641 struct llc_sock *llc = llc_sk(sk); 644 struct llc_sock *llc = llc_sk(sk);
642 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 645 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
643 646
644 if (nskb) { 647 if (nskb) {
645 struct llc_sap *sap = llc->sap; 648 struct llc_sap *sap = llc->sap;
@@ -663,7 +666,7 @@ int llc_conn_ac_send_rr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
663{ 666{
664 int rc = -ENOBUFS; 667 int rc = -ENOBUFS;
665 struct llc_sock *llc = llc_sk(sk); 668 struct llc_sock *llc = llc_sk(sk);
666 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 669 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
667 670
668 if (nskb) { 671 if (nskb) {
669 struct llc_sap *sap = llc->sap; 672 struct llc_sap *sap = llc->sap;
@@ -688,7 +691,7 @@ int llc_conn_ac_send_ack_rsp_f_set_1(struct sock *sk, struct sk_buff *skb)
688{ 691{
689 int rc = -ENOBUFS; 692 int rc = -ENOBUFS;
690 struct llc_sock *llc = llc_sk(sk); 693 struct llc_sock *llc = llc_sk(sk);
691 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 694 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
692 695
693 if (nskb) { 696 if (nskb) {
694 struct llc_sap *sap = llc->sap; 697 struct llc_sap *sap = llc->sap;
@@ -712,7 +715,7 @@ int llc_conn_ac_send_rr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
712{ 715{
713 int rc = -ENOBUFS; 716 int rc = -ENOBUFS;
714 struct llc_sock *llc = llc_sk(sk); 717 struct llc_sock *llc = llc_sk(sk);
715 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 718 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
716 719
717 if (nskb) { 720 if (nskb) {
718 struct llc_sap *sap = llc->sap; 721 struct llc_sap *sap = llc->sap;
@@ -736,7 +739,7 @@ int llc_conn_ac_send_ack_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
736{ 739{
737 int rc = -ENOBUFS; 740 int rc = -ENOBUFS;
738 struct llc_sock *llc = llc_sk(sk); 741 struct llc_sock *llc = llc_sk(sk);
739 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 742 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
740 743
741 if (nskb) { 744 if (nskb) {
742 struct llc_sap *sap = llc->sap; 745 struct llc_sap *sap = llc->sap;
@@ -770,7 +773,7 @@ int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb)
770{ 773{
771 int rc = -ENOBUFS; 774 int rc = -ENOBUFS;
772 struct llc_sock *llc = llc_sk(sk); 775 struct llc_sock *llc = llc_sk(sk);
773 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 776 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_U, 0);
774 777
775 if (nskb) { 778 if (nskb) {
776 struct llc_sap *sap = llc->sap; 779 struct llc_sap *sap = llc->sap;
@@ -799,7 +802,7 @@ int llc_conn_ac_send_ua_rsp_f_set_p(struct sock *sk, struct sk_buff *skb)
799 u8 f_bit; 802 u8 f_bit;
800 int rc = -ENOBUFS; 803 int rc = -ENOBUFS;
801 struct llc_sock *llc = llc_sk(sk); 804 struct llc_sock *llc = llc_sk(sk);
802 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 805 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_U, 0);
803 806
804 llc_pdu_decode_pf_bit(skb, &f_bit); 807 llc_pdu_decode_pf_bit(skb, &f_bit);
805 if (nskb) { 808 if (nskb) {
@@ -956,7 +959,7 @@ static int llc_conn_ac_send_rr_rsp_f_set_ackpf(struct sock *sk,
956{ 959{
957 int rc = -ENOBUFS; 960 int rc = -ENOBUFS;
958 struct llc_sock *llc = llc_sk(sk); 961 struct llc_sock *llc = llc_sk(sk);
959 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev); 962 struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_S, 0);
960 963
961 if (nskb) { 964 if (nskb) {
962 struct llc_sap *sap = llc->sap; 965 struct llc_sap *sap = llc->sap;
diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c
index 248b5903bb13..50d5b10e23a2 100644
--- a/net/llc/llc_core.c
+++ b/net/llc/llc_core.c
@@ -25,8 +25,6 @@
25LIST_HEAD(llc_sap_list); 25LIST_HEAD(llc_sap_list);
26DEFINE_RWLOCK(llc_sap_list_lock); 26DEFINE_RWLOCK(llc_sap_list_lock);
27 27
28unsigned char llc_station_mac_sa[ETH_ALEN];
29
30/** 28/**
31 * llc_sap_alloc - allocates and initializes sap. 29 * llc_sap_alloc - allocates and initializes sap.
32 * 30 *
@@ -37,8 +35,8 @@ static struct llc_sap *llc_sap_alloc(void)
37 struct llc_sap *sap = kzalloc(sizeof(*sap), GFP_ATOMIC); 35 struct llc_sap *sap = kzalloc(sizeof(*sap), GFP_ATOMIC);
38 36
39 if (sap) { 37 if (sap) {
38 /* sap->laddr.mac - leave as a null, it's filled by bind */
40 sap->state = LLC_SAP_STATE_ACTIVE; 39 sap->state = LLC_SAP_STATE_ACTIVE;
41 memcpy(sap->laddr.mac, llc_station_mac_sa, ETH_ALEN);
42 rwlock_init(&sap->sk_list.lock); 40 rwlock_init(&sap->sk_list.lock);
43 atomic_set(&sap->refcnt, 1); 41 atomic_set(&sap->refcnt, 1);
44 } 42 }
@@ -167,10 +165,6 @@ static int __init llc_init(void)
167 if (dev != NULL) 165 if (dev != NULL)
168 dev = next_net_device(dev); 166 dev = next_net_device(dev);
169 167
170 if (dev != NULL)
171 memcpy(llc_station_mac_sa, dev->dev_addr, ETH_ALEN);
172 else
173 memset(llc_station_mac_sa, 0, ETH_ALEN);
174 dev_add_pack(&llc_packet_type); 168 dev_add_pack(&llc_packet_type);
175 dev_add_pack(&llc_tr_packet_type); 169 dev_add_pack(&llc_tr_packet_type);
176 return 0; 170 return 0;
@@ -185,7 +179,6 @@ static void __exit llc_exit(void)
185module_init(llc_init); 179module_init(llc_init);
186module_exit(llc_exit); 180module_exit(llc_exit);
187 181
188EXPORT_SYMBOL(llc_station_mac_sa);
189EXPORT_SYMBOL(llc_sap_list); 182EXPORT_SYMBOL(llc_sap_list);
190EXPORT_SYMBOL(llc_sap_list_lock); 183EXPORT_SYMBOL(llc_sap_list_lock);
191EXPORT_SYMBOL(llc_sap_find); 184EXPORT_SYMBOL(llc_sap_find);
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index a69c5c427fe3..1c45f172991e 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -117,8 +117,12 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
117 skb_pull(skb, llc_len); 117 skb_pull(skb, llc_len);
118 if (skb->protocol == htons(ETH_P_802_2)) { 118 if (skb->protocol == htons(ETH_P_802_2)) {
119 __be16 pdulen = eth_hdr(skb)->h_proto; 119 __be16 pdulen = eth_hdr(skb)->h_proto;
120 u16 data_size = ntohs(pdulen) - llc_len; 120 s32 data_size = ntohs(pdulen) - llc_len;
121 121
122 if (data_size < 0 ||
123 ((skb_tail_pointer(skb) -
124 (u8 *)pdu) - llc_len) < data_size)
125 return 0;
122 if (unlikely(pskb_trim_rcsum(skb, data_size))) 126 if (unlikely(pskb_trim_rcsum(skb, data_size)))
123 return 0; 127 return 0;
124 } 128 }
diff --git a/net/llc/llc_pdu.c b/net/llc/llc_pdu.c
index fa8324396db3..2e6cb79196bb 100644
--- a/net/llc/llc_pdu.c
+++ b/net/llc/llc_pdu.c
@@ -241,7 +241,7 @@ void llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, struct llc_pdu_sn *prev_pdu,
241 FRMR_INFO_SET_PDU_INFO_2LONG_IND(frmr_info, vzyxw); 241 FRMR_INFO_SET_PDU_INFO_2LONG_IND(frmr_info, vzyxw);
242 FRMR_INFO_SET_PDU_INVALID_Nr_IND(frmr_info, vzyxw); 242 FRMR_INFO_SET_PDU_INVALID_Nr_IND(frmr_info, vzyxw);
243 FRMR_INFO_SET_PDU_INVALID_Ns_IND(frmr_info, vzyxw); 243 FRMR_INFO_SET_PDU_INVALID_Ns_IND(frmr_info, vzyxw);
244 skb_put(skb, 5); 244 skb_put(skb, sizeof(struct llc_frmr_info));
245} 245}
246 246
247/** 247/**
diff --git a/net/llc/llc_s_ac.c b/net/llc/llc_s_ac.c
index ac3d93b210d2..a94bd56bcac6 100644
--- a/net/llc/llc_s_ac.c
+++ b/net/llc/llc_s_ac.c
@@ -103,7 +103,8 @@ int llc_sap_action_send_xid_r(struct llc_sap *sap, struct sk_buff *skb)
103 llc_pdu_decode_sa(skb, mac_da); 103 llc_pdu_decode_sa(skb, mac_da);
104 llc_pdu_decode_da(skb, mac_sa); 104 llc_pdu_decode_da(skb, mac_sa);
105 llc_pdu_decode_ssap(skb, &dsap); 105 llc_pdu_decode_ssap(skb, &dsap);
106 nskb = llc_alloc_frame(NULL, skb->dev); 106 nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U,
107 sizeof(struct llc_xid_info));
107 if (!nskb) 108 if (!nskb)
108 goto out; 109 goto out;
109 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap, 110 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap,
@@ -144,11 +145,15 @@ int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb)
144 u8 mac_da[ETH_ALEN], mac_sa[ETH_ALEN], dsap; 145 u8 mac_da[ETH_ALEN], mac_sa[ETH_ALEN], dsap;
145 struct sk_buff *nskb; 146 struct sk_buff *nskb;
146 int rc = 1; 147 int rc = 1;
148 u32 data_size;
147 149
148 llc_pdu_decode_sa(skb, mac_da); 150 llc_pdu_decode_sa(skb, mac_da);
149 llc_pdu_decode_da(skb, mac_sa); 151 llc_pdu_decode_da(skb, mac_sa);
150 llc_pdu_decode_ssap(skb, &dsap); 152 llc_pdu_decode_ssap(skb, &dsap);
151 nskb = llc_alloc_frame(NULL, skb->dev); 153
154 /* The test request command is type U (llc_len = 3) */
155 data_size = ntohs(eth_hdr(skb)->h_proto) - 3;
156 nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U, data_size);
152 if (!nskb) 157 if (!nskb)
153 goto out; 158 goto out;
154 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap, 159 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap,
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index 2525165e2e8f..e2ddde755019 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -24,20 +24,41 @@
24#include <net/tcp_states.h> 24#include <net/tcp_states.h>
25#include <linux/llc.h> 25#include <linux/llc.h>
26 26
27static int llc_mac_header_len(unsigned short devtype)
28{
29 switch (devtype) {
30 case ARPHRD_ETHER:
31 case ARPHRD_LOOPBACK:
32 return sizeof(struct ethhdr);
33#ifdef CONFIG_TR
34 case ARPHRD_IEEE802_TR:
35 return sizeof(struct trh_hdr);
36#endif
37 }
38 return 0;
39}
40
27/** 41/**
28 * llc_alloc_frame - allocates sk_buff for frame 42 * llc_alloc_frame - allocates sk_buff for frame
29 * @dev: network device this skb will be sent over 43 * @dev: network device this skb will be sent over
44 * @type: pdu type to allocate
45 * @data_size: data size to allocate
30 * 46 *
31 * Allocates an sk_buff for frame and initializes sk_buff fields. 47 * Allocates an sk_buff for frame and initializes sk_buff fields.
32 * Returns allocated skb or %NULL when out of memory. 48 * Returns allocated skb or %NULL when out of memory.
33 */ 49 */
34struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev) 50struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev,
51 u8 type, u32 data_size)
35{ 52{
36 struct sk_buff *skb = alloc_skb(128, GFP_ATOMIC); 53 int hlen = type == LLC_PDU_TYPE_U ? 3 : 4;
54 struct sk_buff *skb;
55
56 hlen += llc_mac_header_len(dev->type);
57 skb = alloc_skb(hlen + data_size, GFP_ATOMIC);
37 58
38 if (skb) { 59 if (skb) {
39 skb_reset_mac_header(skb); 60 skb_reset_mac_header(skb);
40 skb_reserve(skb, 50); 61 skb_reserve(skb, hlen);
41 skb_reset_network_header(skb); 62 skb_reset_network_header(skb);
42 skb_reset_transport_header(skb); 63 skb_reset_transport_header(skb);
43 skb->protocol = htons(ETH_P_802_2); 64 skb->protocol = htons(ETH_P_802_2);
diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c
index 6f2ea2090322..83da13339490 100644
--- a/net/llc/llc_station.c
+++ b/net/llc/llc_station.c
@@ -253,13 +253,14 @@ static int llc_station_ac_inc_xid_r_cnt_by_1(struct sk_buff *skb)
253static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb) 253static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb)
254{ 254{
255 int rc = 1; 255 int rc = 1;
256 struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev); 256 struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U,
257 sizeof(struct llc_xid_info));
257 258
258 if (!nskb) 259 if (!nskb)
259 goto out; 260 goto out;
260 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, 0, LLC_PDU_CMD); 261 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, 0, LLC_PDU_CMD);
261 llc_pdu_init_as_xid_cmd(nskb, LLC_XID_NULL_CLASS_2, 127); 262 llc_pdu_init_as_xid_cmd(nskb, LLC_XID_NULL_CLASS_2, 127);
262 rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, llc_station_mac_sa); 263 rc = llc_mac_hdr_init(nskb, skb->dev->dev_addr, skb->dev->dev_addr);
263 if (unlikely(rc)) 264 if (unlikely(rc))
264 goto free; 265 goto free;
265 llc_station_send_pdu(nskb); 266 llc_station_send_pdu(nskb);
@@ -274,7 +275,8 @@ static int llc_station_ac_send_xid_r(struct sk_buff *skb)
274{ 275{
275 u8 mac_da[ETH_ALEN], dsap; 276 u8 mac_da[ETH_ALEN], dsap;
276 int rc = 1; 277 int rc = 1;
277 struct sk_buff* nskb = llc_alloc_frame(NULL, skb->dev); 278 struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U,
279 sizeof(struct llc_xid_info));
278 280
279 if (!nskb) 281 if (!nskb)
280 goto out; 282 goto out;
@@ -283,7 +285,7 @@ static int llc_station_ac_send_xid_r(struct sk_buff *skb)
283 llc_pdu_decode_ssap(skb, &dsap); 285 llc_pdu_decode_ssap(skb, &dsap);
284 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); 286 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP);
285 llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 127); 287 llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 127);
286 rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); 288 rc = llc_mac_hdr_init(nskb, skb->dev->dev_addr, mac_da);
287 if (unlikely(rc)) 289 if (unlikely(rc))
288 goto free; 290 goto free;
289 llc_station_send_pdu(nskb); 291 llc_station_send_pdu(nskb);
@@ -298,7 +300,12 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb)
298{ 300{
299 u8 mac_da[ETH_ALEN], dsap; 301 u8 mac_da[ETH_ALEN], dsap;
300 int rc = 1; 302 int rc = 1;
301 struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev); 303 u32 data_size;
304 struct sk_buff *nskb;
305
306 /* The test request command is type U (llc_len = 3) */
307 data_size = ntohs(eth_hdr(skb)->h_proto) - 3;
308 nskb = llc_alloc_frame(NULL, skb->dev, LLC_PDU_TYPE_U, data_size);
302 309
303 if (!nskb) 310 if (!nskb)
304 goto out; 311 goto out;
@@ -307,7 +314,7 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb)
307 llc_pdu_decode_ssap(skb, &dsap); 314 llc_pdu_decode_ssap(skb, &dsap);
308 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); 315 llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP);
309 llc_pdu_init_as_test_rsp(nskb, skb); 316 llc_pdu_init_as_test_rsp(nskb, skb);
310 rc = llc_mac_hdr_init(nskb, llc_station_mac_sa, mac_da); 317 rc = llc_mac_hdr_init(nskb, skb->dev->dev_addr, mac_da);
311 if (unlikely(rc)) 318 if (unlikely(rc))
312 goto free; 319 goto free;
313 llc_station_send_pdu(nskb); 320 llc_station_send_pdu(nskb);
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 5ee431b6256c..aaa5480e204a 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -375,6 +375,18 @@ static int ieee80211_open(struct net_device *dev)
375 if (need_hw_reconfig) 375 if (need_hw_reconfig)
376 ieee80211_hw_config(local); 376 ieee80211_hw_config(local);
377 377
378 /*
379 * ieee80211_sta_work is disabled while network interface
380 * is down. Therefore, some configuration changes may not
381 * yet be effective. Trigger execution of ieee80211_sta_work
382 * to fix this.
383 */
384 if(sdata->vif.type == IEEE80211_IF_TYPE_STA ||
385 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
386 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
387 queue_work(local->hw.workqueue, &ifsta->work);
388 }
389
378 netif_start_queue(dev); 390 netif_start_queue(dev);
379 391
380 return 0; 392 return 0;
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 110eaf3ab58c..c20ef89acad6 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -360,7 +360,7 @@ static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata,
360 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; 360 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf;
361 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 361 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
362 bool use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; 362 bool use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0;
363 bool preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0; 363 bool use_short_preamble = (erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0;
364 DECLARE_MAC_BUF(mac); 364 DECLARE_MAC_BUF(mac);
365 u32 changed = 0; 365 u32 changed = 0;
366 366
@@ -376,16 +376,15 @@ static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata,
376 changed |= BSS_CHANGED_ERP_CTS_PROT; 376 changed |= BSS_CHANGED_ERP_CTS_PROT;
377 } 377 }
378 378
379 if (preamble_mode != bss_conf->use_short_preamble) { 379 if (use_short_preamble != bss_conf->use_short_preamble) {
380 if (net_ratelimit()) { 380 if (net_ratelimit()) {
381 printk(KERN_DEBUG "%s: switched to %s barker preamble" 381 printk(KERN_DEBUG "%s: switched to %s barker preamble"
382 " (BSSID=%s)\n", 382 " (BSSID=%s)\n",
383 sdata->dev->name, 383 sdata->dev->name,
384 (preamble_mode == WLAN_ERP_PREAMBLE_SHORT) ? 384 use_short_preamble ? "short" : "long",
385 "short" : "long",
386 print_mac(mac, ifsta->bssid)); 385 print_mac(mac, ifsta->bssid));
387 } 386 }
388 bss_conf->use_short_preamble = preamble_mode; 387 bss_conf->use_short_preamble = use_short_preamble;
389 changed |= BSS_CHANGED_ERP_PREAMBLE; 388 changed |= BSS_CHANGED_ERP_PREAMBLE;
390 } 389 }
391 390
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 92d85c38e4d2..d1ff3f885c5d 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -598,17 +598,24 @@ static int rose_release(struct socket *sock)
598 598
599 if (sk == NULL) return 0; 599 if (sk == NULL) return 0;
600 600
601 sock_hold(sk);
602 sock_orphan(sk);
603 lock_sock(sk);
601 rose = rose_sk(sk); 604 rose = rose_sk(sk);
602 605
603 switch (rose->state) { 606 switch (rose->state) {
604 case ROSE_STATE_0: 607 case ROSE_STATE_0:
608 release_sock(sk);
605 rose_disconnect(sk, 0, -1, -1); 609 rose_disconnect(sk, 0, -1, -1);
610 lock_sock(sk);
606 rose_destroy_socket(sk); 611 rose_destroy_socket(sk);
607 break; 612 break;
608 613
609 case ROSE_STATE_2: 614 case ROSE_STATE_2:
610 rose->neighbour->use--; 615 rose->neighbour->use--;
616 release_sock(sk);
611 rose_disconnect(sk, 0, -1, -1); 617 rose_disconnect(sk, 0, -1, -1);
618 lock_sock(sk);
612 rose_destroy_socket(sk); 619 rose_destroy_socket(sk);
613 break; 620 break;
614 621
@@ -633,6 +640,8 @@ static int rose_release(struct socket *sock)
633 } 640 }
634 641
635 sock->sk = NULL; 642 sock->sk = NULL;
643 release_sock(sk);
644 sock_put(sk);
636 645
637 return 0; 646 return 0;
638} 647}
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 10b5c0887fff..b741618e4d54 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -184,10 +184,22 @@ static inline int qdisc_restart(struct net_device *dev)
184 184
185void __qdisc_run(struct net_device *dev) 185void __qdisc_run(struct net_device *dev)
186{ 186{
187 do { 187 unsigned long start_time = jiffies;
188 if (!qdisc_restart(dev)) 188
189 while (qdisc_restart(dev)) {
190 if (netif_queue_stopped(dev))
191 break;
192
193 /*
194 * Postpone processing if
195 * 1. another process needs the CPU;
196 * 2. we've been doing it for too long.
197 */
198 if (need_resched() || jiffies != start_time) {
199 netif_schedule(dev);
189 break; 200 break;
190 } while (!netif_queue_stopped(dev)); 201 }
202 }
191 203
192 clear_bit(__LINK_STATE_QDISC_RUNNING, &dev->state); 204 clear_bit(__LINK_STATE_QDISC_RUNNING, &dev->state);
193} 205}