diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-06 10:49:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-06 10:49:20 -0400 |
commit | 4880d10927c93d858d40e297361fff375ee98492 (patch) | |
tree | 05568234832389c4a357281da3a4f047841b59d4 /net | |
parent | a15306365a16380f3bafee9e181ba01231d4acd7 (diff) | |
parent | 9d1045ad68fcccfaf1393cc463ab6357693e8d1d (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
net_cls_act: act_simple dont ignore realloc code
iwlwifi: make IWLWIFI a tristate
Revert "atm: Do not free already unregistered net device."
dccp: return -EINVAL on invalid feature length
irda: fix !PNP support for drivers/net/irda/smsc-ircc2.c
irda: fix !PNP support in drivers/net/irda/nsc-ircc.c
net_cls_act: Make act_simple use of netlink policy.
ip: Use inline function dst_metric() instead of direct access to dst->metric[]
ip: Make use of the inline function dst_metric_locked()
atm: Bad locking on br2684_devs modifications.
atm: Do not free already unregistered net device.
mac80211: Do not free net device after it is unregistered.
bridge: Consolidate error paths in br_add_bridge().
bridge: Net device leak in br_add_bridge().
niu: Fix probing regression for maramba on-board chips.
lapbeth: Release ->ethdev when unregistering device.
xfrm: convert empty xfrm_audit_* macros to functions
net: Fix useless comment reference loop.
sch_htb: remove from event queue in htb_parent_to_leaf()
Diffstat (limited to 'net')
-rw-r--r-- | net/atm/br2684.c | 4 | ||||
-rw-r--r-- | net/bridge/br_if.c | 12 | ||||
-rw-r--r-- | net/core/skbuff.c | 4 | ||||
-rw-r--r-- | net/dccp/feat.c | 2 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 12 | ||||
-rw-r--r-- | net/ipv4/route.c | 18 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 15 | ||||
-rw-r--r-- | net/ipv6/route.c | 6 | ||||
-rw-r--r-- | net/mac80211/main.c | 7 | ||||
-rw-r--r-- | net/sched/act_simple.c | 45 | ||||
-rw-r--r-- | net/sched/sch_htb.c | 8 |
11 files changed, 72 insertions, 61 deletions
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index 1b228065e745..9d52ebfc1962 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
@@ -346,9 +346,9 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb) | |||
346 | /* skb==NULL means VCC is being destroyed */ | 346 | /* skb==NULL means VCC is being destroyed */ |
347 | br2684_close_vcc(brvcc); | 347 | br2684_close_vcc(brvcc); |
348 | if (list_empty(&brdev->brvccs)) { | 348 | if (list_empty(&brdev->brvccs)) { |
349 | read_lock(&devs_lock); | 349 | write_lock_irq(&devs_lock); |
350 | list_del(&brdev->br2684_devs); | 350 | list_del(&brdev->br2684_devs); |
351 | read_unlock(&devs_lock); | 351 | write_unlock_irq(&devs_lock); |
352 | unregister_netdev(net_dev); | 352 | unregister_netdev(net_dev); |
353 | free_netdev(net_dev); | 353 | free_netdev(net_dev); |
354 | } | 354 | } |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 77a981a1ee52..c2397f503b0f 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -273,15 +273,13 @@ int br_add_bridge(const char *name) | |||
273 | rtnl_lock(); | 273 | rtnl_lock(); |
274 | if (strchr(dev->name, '%')) { | 274 | if (strchr(dev->name, '%')) { |
275 | ret = dev_alloc_name(dev, dev->name); | 275 | ret = dev_alloc_name(dev, dev->name); |
276 | if (ret < 0) { | 276 | if (ret < 0) |
277 | free_netdev(dev); | 277 | goto out_free; |
278 | goto out; | ||
279 | } | ||
280 | } | 278 | } |
281 | 279 | ||
282 | ret = register_netdevice(dev); | 280 | ret = register_netdevice(dev); |
283 | if (ret) | 281 | if (ret) |
284 | goto out; | 282 | goto out_free; |
285 | 283 | ||
286 | ret = br_sysfs_addbr(dev); | 284 | ret = br_sysfs_addbr(dev); |
287 | if (ret) | 285 | if (ret) |
@@ -289,6 +287,10 @@ int br_add_bridge(const char *name) | |||
289 | out: | 287 | out: |
290 | rtnl_unlock(); | 288 | rtnl_unlock(); |
291 | return ret; | 289 | return ret; |
290 | |||
291 | out_free: | ||
292 | free_netdev(dev); | ||
293 | goto out; | ||
292 | } | 294 | } |
293 | 295 | ||
294 | int br_del_bridge(const char *name) | 296 | int br_del_bridge(const char *name) |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 4fe605fa6f8a..5c459f2b7985 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -200,7 +200,9 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, | |||
200 | goto nodata; | 200 | goto nodata; |
201 | 201 | ||
202 | /* | 202 | /* |
203 | * See comment in sk_buff definition, just before the 'tail' member | 203 | * Only clear those fields we need to clear, not those that we will |
204 | * actually initialise below. Hence, don't put any more fields after | ||
205 | * the tail pointer in struct sk_buff! | ||
204 | */ | 206 | */ |
205 | memset(skb, 0, offsetof(struct sk_buff, tail)); | 207 | memset(skb, 0, offsetof(struct sk_buff, tail)); |
206 | skb->truesize = size + sizeof(struct sk_buff); | 208 | skb->truesize = size + sizeof(struct sk_buff); |
diff --git a/net/dccp/feat.c b/net/dccp/feat.c index 4a4f6ce4498d..933a0ecf8d46 100644 --- a/net/dccp/feat.c +++ b/net/dccp/feat.c | |||
@@ -32,7 +32,7 @@ int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature, | |||
32 | 32 | ||
33 | if (len > 3) { | 33 | if (len > 3) { |
34 | DCCP_WARN("invalid length %d\n", len); | 34 | DCCP_WARN("invalid length %d\n", len); |
35 | return 1; | 35 | return -EINVAL; |
36 | } | 36 | } |
37 | /* XXX add further sanity checks */ | 37 | /* XXX add further sanity checks */ |
38 | 38 | ||
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 2f665a516476..f50e88bf2661 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -235,14 +235,14 @@ static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu) | |||
235 | else | 235 | else |
236 | min_mtu -= 21; | 236 | min_mtu -= 21; |
237 | 237 | ||
238 | if (dst->metrics[RTAX_MTU-1] > mtu && mtu >= min_mtu) { | 238 | if (dst_metric(dst, RTAX_MTU) > mtu && mtu >= min_mtu) { |
239 | if (!(dst_metric_locked(dst, RTAX_MTU))) { | 239 | if (!(dst_metric_locked(dst, RTAX_MTU))) { |
240 | dst->metrics[RTAX_MTU-1] = mtu; | 240 | dst->metrics[RTAX_MTU-1] = mtu; |
241 | dst_set_expires(dst, dn_rt_mtu_expires); | 241 | dst_set_expires(dst, dn_rt_mtu_expires); |
242 | } | 242 | } |
243 | if (!(dst_metric_locked(dst, RTAX_ADVMSS))) { | 243 | if (!(dst_metric_locked(dst, RTAX_ADVMSS))) { |
244 | u32 mss = mtu - DN_MAX_NSP_DATA_HEADER; | 244 | u32 mss = mtu - DN_MAX_NSP_DATA_HEADER; |
245 | if (dst->metrics[RTAX_ADVMSS-1] > mss) | 245 | if (dst_metric(dst, RTAX_ADVMSS) > mss) |
246 | dst->metrics[RTAX_ADVMSS-1] = mss; | 246 | dst->metrics[RTAX_ADVMSS-1] = mss; |
247 | } | 247 | } |
248 | } | 248 | } |
@@ -805,12 +805,12 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) | |||
805 | rt->u.dst.neighbour = n; | 805 | rt->u.dst.neighbour = n; |
806 | } | 806 | } |
807 | 807 | ||
808 | if (rt->u.dst.metrics[RTAX_MTU-1] == 0 || | 808 | if (dst_metric(&rt->u.dst, RTAX_MTU) == 0 || |
809 | rt->u.dst.metrics[RTAX_MTU-1] > rt->u.dst.dev->mtu) | 809 | dst_metric(&rt->u.dst, RTAX_MTU) > rt->u.dst.dev->mtu) |
810 | rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu; | 810 | rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu; |
811 | mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->u.dst)); | 811 | mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->u.dst)); |
812 | if (rt->u.dst.metrics[RTAX_ADVMSS-1] == 0 || | 812 | if (dst_metric(&rt->u.dst, RTAX_ADVMSS) == 0 || |
813 | rt->u.dst.metrics[RTAX_ADVMSS-1] > mss) | 813 | dst_metric(&rt->u.dst, RTAX_ADVMSS) > mss) |
814 | rt->u.dst.metrics[RTAX_ADVMSS-1] = mss; | 814 | rt->u.dst.metrics[RTAX_ADVMSS-1] = mss; |
815 | return 0; | 815 | return 0; |
816 | } | 816 | } |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 5e3685c5c407..92f90ae46f4a 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1468,14 +1468,14 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | |||
1468 | 1468 | ||
1469 | /* BSD 4.2 compatibility hack :-( */ | 1469 | /* BSD 4.2 compatibility hack :-( */ |
1470 | if (mtu == 0 && | 1470 | if (mtu == 0 && |
1471 | old_mtu >= rth->u.dst.metrics[RTAX_MTU-1] && | 1471 | old_mtu >= dst_metric(&rth->u.dst, RTAX_MTU) && |
1472 | old_mtu >= 68 + (iph->ihl << 2)) | 1472 | old_mtu >= 68 + (iph->ihl << 2)) |
1473 | old_mtu -= iph->ihl << 2; | 1473 | old_mtu -= iph->ihl << 2; |
1474 | 1474 | ||
1475 | mtu = guess_mtu(old_mtu); | 1475 | mtu = guess_mtu(old_mtu); |
1476 | } | 1476 | } |
1477 | if (mtu <= rth->u.dst.metrics[RTAX_MTU-1]) { | 1477 | if (mtu <= dst_metric(&rth->u.dst, RTAX_MTU)) { |
1478 | if (mtu < rth->u.dst.metrics[RTAX_MTU-1]) { | 1478 | if (mtu < dst_metric(&rth->u.dst, RTAX_MTU)) { |
1479 | dst_confirm(&rth->u.dst); | 1479 | dst_confirm(&rth->u.dst); |
1480 | if (mtu < ip_rt_min_pmtu) { | 1480 | if (mtu < ip_rt_min_pmtu) { |
1481 | mtu = ip_rt_min_pmtu; | 1481 | mtu = ip_rt_min_pmtu; |
@@ -1497,7 +1497,7 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | |||
1497 | 1497 | ||
1498 | static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) | 1498 | static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) |
1499 | { | 1499 | { |
1500 | if (dst->metrics[RTAX_MTU-1] > mtu && mtu >= 68 && | 1500 | if (dst_metric(dst, RTAX_MTU) > mtu && mtu >= 68 && |
1501 | !(dst_metric_locked(dst, RTAX_MTU))) { | 1501 | !(dst_metric_locked(dst, RTAX_MTU))) { |
1502 | if (mtu < ip_rt_min_pmtu) { | 1502 | if (mtu < ip_rt_min_pmtu) { |
1503 | mtu = ip_rt_min_pmtu; | 1503 | mtu = ip_rt_min_pmtu; |
@@ -1613,7 +1613,7 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) | |||
1613 | sizeof(rt->u.dst.metrics)); | 1613 | sizeof(rt->u.dst.metrics)); |
1614 | if (fi->fib_mtu == 0) { | 1614 | if (fi->fib_mtu == 0) { |
1615 | rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu; | 1615 | rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu; |
1616 | if (rt->u.dst.metrics[RTAX_LOCK-1] & (1 << RTAX_MTU) && | 1616 | if (dst_metric_locked(&rt->u.dst, RTAX_MTU) && |
1617 | rt->rt_gateway != rt->rt_dst && | 1617 | rt->rt_gateway != rt->rt_dst && |
1618 | rt->u.dst.dev->mtu > 576) | 1618 | rt->u.dst.dev->mtu > 576) |
1619 | rt->u.dst.metrics[RTAX_MTU-1] = 576; | 1619 | rt->u.dst.metrics[RTAX_MTU-1] = 576; |
@@ -1624,14 +1624,14 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) | |||
1624 | } else | 1624 | } else |
1625 | rt->u.dst.metrics[RTAX_MTU-1]= rt->u.dst.dev->mtu; | 1625 | rt->u.dst.metrics[RTAX_MTU-1]= rt->u.dst.dev->mtu; |
1626 | 1626 | ||
1627 | if (rt->u.dst.metrics[RTAX_HOPLIMIT-1] == 0) | 1627 | if (dst_metric(&rt->u.dst, RTAX_HOPLIMIT) == 0) |
1628 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = sysctl_ip_default_ttl; | 1628 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = sysctl_ip_default_ttl; |
1629 | if (rt->u.dst.metrics[RTAX_MTU-1] > IP_MAX_MTU) | 1629 | if (dst_metric(&rt->u.dst, RTAX_MTU) > IP_MAX_MTU) |
1630 | rt->u.dst.metrics[RTAX_MTU-1] = IP_MAX_MTU; | 1630 | rt->u.dst.metrics[RTAX_MTU-1] = IP_MAX_MTU; |
1631 | if (rt->u.dst.metrics[RTAX_ADVMSS-1] == 0) | 1631 | if (dst_metric(&rt->u.dst, RTAX_ADVMSS) == 0) |
1632 | rt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, rt->u.dst.dev->mtu - 40, | 1632 | rt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, rt->u.dst.dev->mtu - 40, |
1633 | ip_rt_min_advmss); | 1633 | ip_rt_min_advmss); |
1634 | if (rt->u.dst.metrics[RTAX_ADVMSS-1] > 65535 - 40) | 1634 | if (dst_metric(&rt->u.dst, RTAX_ADVMSS) > 65535 - 40) |
1635 | rt->u.dst.metrics[RTAX_ADVMSS-1] = 65535 - 40; | 1635 | rt->u.dst.metrics[RTAX_ADVMSS-1] = 65535 - 40; |
1636 | 1636 | ||
1637 | #ifdef CONFIG_NET_CLS_ROUTE | 1637 | #ifdef CONFIG_NET_CLS_ROUTE |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index eda4f4a233f3..8ac15a604e08 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <linux/mm.h> | 66 | #include <linux/mm.h> |
67 | #include <linux/module.h> | 67 | #include <linux/module.h> |
68 | #include <linux/sysctl.h> | 68 | #include <linux/sysctl.h> |
69 | #include <net/dst.h> | ||
69 | #include <net/tcp.h> | 70 | #include <net/tcp.h> |
70 | #include <net/inet_common.h> | 71 | #include <net/inet_common.h> |
71 | #include <linux/ipsec.h> | 72 | #include <linux/ipsec.h> |
@@ -605,7 +606,7 @@ static u32 tcp_rto_min(struct sock *sk) | |||
605 | u32 rto_min = TCP_RTO_MIN; | 606 | u32 rto_min = TCP_RTO_MIN; |
606 | 607 | ||
607 | if (dst && dst_metric_locked(dst, RTAX_RTO_MIN)) | 608 | if (dst && dst_metric_locked(dst, RTAX_RTO_MIN)) |
608 | rto_min = dst->metrics[RTAX_RTO_MIN - 1]; | 609 | rto_min = dst_metric(dst, RTAX_RTO_MIN); |
609 | return rto_min; | 610 | return rto_min; |
610 | } | 611 | } |
611 | 612 | ||
@@ -769,7 +770,7 @@ void tcp_update_metrics(struct sock *sk) | |||
769 | dst->metrics[RTAX_RTTVAR - 1] = m; | 770 | dst->metrics[RTAX_RTTVAR - 1] = m; |
770 | else | 771 | else |
771 | dst->metrics[RTAX_RTTVAR-1] -= | 772 | dst->metrics[RTAX_RTTVAR-1] -= |
772 | (dst->metrics[RTAX_RTTVAR-1] - m)>>2; | 773 | (dst_metric(dst, RTAX_RTTVAR) - m)>>2; |
773 | } | 774 | } |
774 | 775 | ||
775 | if (tp->snd_ssthresh >= 0xFFFF) { | 776 | if (tp->snd_ssthresh >= 0xFFFF) { |
@@ -788,21 +789,21 @@ void tcp_update_metrics(struct sock *sk) | |||
788 | dst->metrics[RTAX_SSTHRESH-1] = | 789 | dst->metrics[RTAX_SSTHRESH-1] = |
789 | max(tp->snd_cwnd >> 1, tp->snd_ssthresh); | 790 | max(tp->snd_cwnd >> 1, tp->snd_ssthresh); |
790 | if (!dst_metric_locked(dst, RTAX_CWND)) | 791 | if (!dst_metric_locked(dst, RTAX_CWND)) |
791 | dst->metrics[RTAX_CWND-1] = (dst->metrics[RTAX_CWND-1] + tp->snd_cwnd) >> 1; | 792 | dst->metrics[RTAX_CWND-1] = (dst_metric(dst, RTAX_CWND) + tp->snd_cwnd) >> 1; |
792 | } else { | 793 | } else { |
793 | /* Else slow start did not finish, cwnd is non-sense, | 794 | /* Else slow start did not finish, cwnd is non-sense, |
794 | ssthresh may be also invalid. | 795 | ssthresh may be also invalid. |
795 | */ | 796 | */ |
796 | if (!dst_metric_locked(dst, RTAX_CWND)) | 797 | if (!dst_metric_locked(dst, RTAX_CWND)) |
797 | dst->metrics[RTAX_CWND-1] = (dst->metrics[RTAX_CWND-1] + tp->snd_ssthresh) >> 1; | 798 | dst->metrics[RTAX_CWND-1] = (dst_metric(dst, RTAX_CWND) + tp->snd_ssthresh) >> 1; |
798 | if (dst->metrics[RTAX_SSTHRESH-1] && | 799 | if (dst_metric(dst, RTAX_SSTHRESH) && |
799 | !dst_metric_locked(dst, RTAX_SSTHRESH) && | 800 | !dst_metric_locked(dst, RTAX_SSTHRESH) && |
800 | tp->snd_ssthresh > dst->metrics[RTAX_SSTHRESH-1]) | 801 | tp->snd_ssthresh > dst_metric(dst, RTAX_SSTHRESH)) |
801 | dst->metrics[RTAX_SSTHRESH-1] = tp->snd_ssthresh; | 802 | dst->metrics[RTAX_SSTHRESH-1] = tp->snd_ssthresh; |
802 | } | 803 | } |
803 | 804 | ||
804 | if (!dst_metric_locked(dst, RTAX_REORDERING)) { | 805 | if (!dst_metric_locked(dst, RTAX_REORDERING)) { |
805 | if (dst->metrics[RTAX_REORDERING-1] < tp->reordering && | 806 | if (dst_metric(dst, RTAX_REORDERING) < tp->reordering && |
806 | tp->reordering != sysctl_tcp_reordering) | 807 | tp->reordering != sysctl_tcp_reordering) |
807 | dst->metrics[RTAX_REORDERING-1] = tp->reordering; | 808 | dst->metrics[RTAX_REORDERING-1] = tp->reordering; |
808 | } | 809 | } |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index a493ad9b8914..12bba0880345 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1243,11 +1243,11 @@ install_route: | |||
1243 | } | 1243 | } |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | if (rt->u.dst.metrics[RTAX_HOPLIMIT-1] == 0) | 1246 | if (dst_metric(&rt->u.dst, RTAX_HOPLIMIT) == 0) |
1247 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = -1; | 1247 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = -1; |
1248 | if (!rt->u.dst.metrics[RTAX_MTU-1]) | 1248 | if (!dst_metric(&rt->u.dst, RTAX_MTU)) |
1249 | rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev); | 1249 | rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev); |
1250 | if (!rt->u.dst.metrics[RTAX_ADVMSS-1]) | 1250 | if (!dst_metric(&rt->u.dst, RTAX_ADVMSS)) |
1251 | rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(net, dst_mtu(&rt->u.dst)); | 1251 | rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(net, dst_mtu(&rt->u.dst)); |
1252 | rt->u.dst.dev = dev; | 1252 | rt->u.dst.dev = dev; |
1253 | rt->rt6i_idev = idev; | 1253 | rt->rt6i_idev = idev; |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 9ad4e3631b6b..915afadb0602 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -1766,6 +1766,7 @@ fail_wep: | |||
1766 | fail_rate: | 1766 | fail_rate: |
1767 | ieee80211_debugfs_remove_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); | 1767 | ieee80211_debugfs_remove_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); |
1768 | unregister_netdevice(local->mdev); | 1768 | unregister_netdevice(local->mdev); |
1769 | local->mdev = NULL; | ||
1769 | fail_dev: | 1770 | fail_dev: |
1770 | rtnl_unlock(); | 1771 | rtnl_unlock(); |
1771 | sta_info_stop(local); | 1772 | sta_info_stop(local); |
@@ -1773,8 +1774,10 @@ fail_sta_info: | |||
1773 | debugfs_hw_del(local); | 1774 | debugfs_hw_del(local); |
1774 | destroy_workqueue(local->hw.workqueue); | 1775 | destroy_workqueue(local->hw.workqueue); |
1775 | fail_workqueue: | 1776 | fail_workqueue: |
1776 | ieee80211_if_free(local->mdev); | 1777 | if (local->mdev != NULL) { |
1777 | local->mdev = NULL; | 1778 | ieee80211_if_free(local->mdev); |
1779 | local->mdev = NULL; | ||
1780 | } | ||
1778 | fail_mdev_alloc: | 1781 | fail_mdev_alloc: |
1779 | wiphy_unregister(local->hw.wiphy); | 1782 | wiphy_unregister(local->hw.wiphy); |
1780 | return result; | 1783 | return result; |
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 64b2d136c78e..1d421d059caf 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * as published by the Free Software Foundation; either version | 6 | * as published by the Free Software Foundation; either version |
7 | * 2 of the License, or (at your option) any later version. | 7 | * 2 of the License, or (at your option) any later version. |
8 | * | 8 | * |
9 | * Authors: Jamal Hadi Salim (2005) | 9 | * Authors: Jamal Hadi Salim (2005-8) |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
@@ -34,6 +34,7 @@ static struct tcf_hashinfo simp_hash_info = { | |||
34 | .lock = &simp_lock, | 34 | .lock = &simp_lock, |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #define SIMP_MAX_DATA 32 | ||
37 | static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res) | 38 | static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res) |
38 | { | 39 | { |
39 | struct tcf_defact *d = a->priv; | 40 | struct tcf_defact *d = a->priv; |
@@ -69,23 +70,28 @@ static int tcf_simp_release(struct tcf_defact *d, int bind) | |||
69 | return ret; | 70 | return ret; |
70 | } | 71 | } |
71 | 72 | ||
72 | static int alloc_defdata(struct tcf_defact *d, u32 datalen, void *defdata) | 73 | static int alloc_defdata(struct tcf_defact *d, char *defdata) |
73 | { | 74 | { |
74 | d->tcfd_defdata = kmemdup(defdata, datalen, GFP_KERNEL); | 75 | d->tcfd_defdata = kstrndup(defdata, SIMP_MAX_DATA, GFP_KERNEL); |
75 | if (unlikely(!d->tcfd_defdata)) | 76 | if (unlikely(!d->tcfd_defdata)) |
76 | return -ENOMEM; | 77 | return -ENOMEM; |
77 | d->tcfd_datalen = datalen; | 78 | |
78 | return 0; | 79 | return 0; |
79 | } | 80 | } |
80 | 81 | ||
81 | static int realloc_defdata(struct tcf_defact *d, u32 datalen, void *defdata) | 82 | static void reset_policy(struct tcf_defact *d, char *defdata, |
83 | struct tc_defact *p) | ||
82 | { | 84 | { |
83 | kfree(d->tcfd_defdata); | 85 | spin_lock_bh(&d->tcf_lock); |
84 | return alloc_defdata(d, datalen, defdata); | 86 | d->tcf_action = p->action; |
87 | memset(d->tcfd_defdata, 0, SIMP_MAX_DATA); | ||
88 | strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA); | ||
89 | spin_unlock_bh(&d->tcf_lock); | ||
85 | } | 90 | } |
86 | 91 | ||
87 | static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = { | 92 | static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = { |
88 | [TCA_DEF_PARMS] = { .len = sizeof(struct tc_defact) }, | 93 | [TCA_DEF_PARMS] = { .len = sizeof(struct tc_defact) }, |
94 | [TCA_DEF_DATA] = { .type = NLA_STRING, .len = SIMP_MAX_DATA }, | ||
89 | }; | 95 | }; |
90 | 96 | ||
91 | static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, | 97 | static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, |
@@ -95,28 +101,24 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, | |||
95 | struct tc_defact *parm; | 101 | struct tc_defact *parm; |
96 | struct tcf_defact *d; | 102 | struct tcf_defact *d; |
97 | struct tcf_common *pc; | 103 | struct tcf_common *pc; |
98 | void *defdata; | 104 | char *defdata; |
99 | u32 datalen = 0; | ||
100 | int ret = 0, err; | 105 | int ret = 0, err; |
101 | 106 | ||
102 | if (nla == NULL) | 107 | if (nla == NULL) |
103 | return -EINVAL; | 108 | return -EINVAL; |
104 | 109 | ||
105 | err = nla_parse_nested(tb, TCA_DEF_MAX, nla, NULL); | 110 | err = nla_parse_nested(tb, TCA_DEF_MAX, nla, simple_policy); |
106 | if (err < 0) | 111 | if (err < 0) |
107 | return err; | 112 | return err; |
108 | 113 | ||
109 | if (tb[TCA_DEF_PARMS] == NULL) | 114 | if (tb[TCA_DEF_PARMS] == NULL) |
110 | return -EINVAL; | 115 | return -EINVAL; |
111 | 116 | ||
112 | parm = nla_data(tb[TCA_DEF_PARMS]); | 117 | if (tb[TCA_DEF_DATA] == NULL) |
113 | defdata = nla_data(tb[TCA_DEF_DATA]); | ||
114 | if (defdata == NULL) | ||
115 | return -EINVAL; | 118 | return -EINVAL; |
116 | 119 | ||
117 | datalen = nla_len(tb[TCA_DEF_DATA]); | 120 | parm = nla_data(tb[TCA_DEF_PARMS]); |
118 | if (datalen == 0) | 121 | defdata = nla_data(tb[TCA_DEF_DATA]); |
119 | return -EINVAL; | ||
120 | 122 | ||
121 | pc = tcf_hash_check(parm->index, a, bind, &simp_hash_info); | 123 | pc = tcf_hash_check(parm->index, a, bind, &simp_hash_info); |
122 | if (!pc) { | 124 | if (!pc) { |
@@ -126,11 +128,12 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, | |||
126 | return -ENOMEM; | 128 | return -ENOMEM; |
127 | 129 | ||
128 | d = to_defact(pc); | 130 | d = to_defact(pc); |
129 | ret = alloc_defdata(d, datalen, defdata); | 131 | ret = alloc_defdata(d, defdata); |
130 | if (ret < 0) { | 132 | if (ret < 0) { |
131 | kfree(pc); | 133 | kfree(pc); |
132 | return ret; | 134 | return ret; |
133 | } | 135 | } |
136 | d->tcf_action = parm->action; | ||
134 | ret = ACT_P_CREATED; | 137 | ret = ACT_P_CREATED; |
135 | } else { | 138 | } else { |
136 | d = to_defact(pc); | 139 | d = to_defact(pc); |
@@ -138,13 +141,9 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, | |||
138 | tcf_simp_release(d, bind); | 141 | tcf_simp_release(d, bind); |
139 | return -EEXIST; | 142 | return -EEXIST; |
140 | } | 143 | } |
141 | realloc_defdata(d, datalen, defdata); | 144 | reset_policy(d, defdata, parm); |
142 | } | 145 | } |
143 | 146 | ||
144 | spin_lock_bh(&d->tcf_lock); | ||
145 | d->tcf_action = parm->action; | ||
146 | spin_unlock_bh(&d->tcf_lock); | ||
147 | |||
148 | if (ret == ACT_P_CREATED) | 147 | if (ret == ACT_P_CREATED) |
149 | tcf_hash_insert(pc, &simp_hash_info); | 148 | tcf_hash_insert(pc, &simp_hash_info); |
150 | return ret; | 149 | return ret; |
@@ -172,7 +171,7 @@ static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, | |||
172 | opt.bindcnt = d->tcf_bindcnt - bind; | 171 | opt.bindcnt = d->tcf_bindcnt - bind; |
173 | opt.action = d->tcf_action; | 172 | opt.action = d->tcf_action; |
174 | NLA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); | 173 | NLA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); |
175 | NLA_PUT(skb, TCA_DEF_DATA, d->tcfd_datalen, d->tcfd_defdata); | 174 | NLA_PUT_STRING(skb, TCA_DEF_DATA, d->tcfd_defdata); |
176 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); | 175 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); |
177 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); | 176 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); |
178 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); | 177 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 66148cc4759e..5bc1ed490180 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1197,12 +1197,16 @@ static inline int htb_parent_last_child(struct htb_class *cl) | |||
1197 | return 1; | 1197 | return 1; |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | static void htb_parent_to_leaf(struct htb_class *cl, struct Qdisc *new_q) | 1200 | static void htb_parent_to_leaf(struct htb_sched *q, struct htb_class *cl, |
1201 | struct Qdisc *new_q) | ||
1201 | { | 1202 | { |
1202 | struct htb_class *parent = cl->parent; | 1203 | struct htb_class *parent = cl->parent; |
1203 | 1204 | ||
1204 | BUG_TRAP(!cl->level && cl->un.leaf.q && !cl->prio_activity); | 1205 | BUG_TRAP(!cl->level && cl->un.leaf.q && !cl->prio_activity); |
1205 | 1206 | ||
1207 | if (parent->cmode != HTB_CAN_SEND) | ||
1208 | htb_safe_rb_erase(&parent->pq_node, q->wait_pq + parent->level); | ||
1209 | |||
1206 | parent->level = 0; | 1210 | parent->level = 0; |
1207 | memset(&parent->un.inner, 0, sizeof(parent->un.inner)); | 1211 | memset(&parent->un.inner, 0, sizeof(parent->un.inner)); |
1208 | INIT_LIST_HEAD(&parent->un.leaf.drop_list); | 1212 | INIT_LIST_HEAD(&parent->un.leaf.drop_list); |
@@ -1300,7 +1304,7 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg) | |||
1300 | htb_deactivate(q, cl); | 1304 | htb_deactivate(q, cl); |
1301 | 1305 | ||
1302 | if (last_child) | 1306 | if (last_child) |
1303 | htb_parent_to_leaf(cl, new_q); | 1307 | htb_parent_to_leaf(q, cl, new_q); |
1304 | 1308 | ||
1305 | if (--cl->refcnt == 0) | 1309 | if (--cl->refcnt == 0) |
1306 | htb_destroy_class(sch, cl); | 1310 | htb_destroy_class(sch, cl); |