aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/atm/idt77105.c2
-rw-r--r--drivers/atm/suni.c2
-rw-r--r--drivers/net/e1000/e1000_main.c1
-rw-r--r--drivers/net/e1000e/netdev.c1
-rw-r--r--drivers/net/ixgb/ixgb_main.c9
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c4
-rw-r--r--drivers/net/veth.c14
-rw-r--r--net/bridge/br_netfilter.c27
-rw-r--r--net/core/neighbour.c4
-rw-r--r--net/core/rtnetlink.c5
-rw-r--r--net/ipv4/fib_hash.c23
-rw-r--r--net/ipv4/fib_trie.c3
-rw-r--r--net/ipv4/icmp.c1
-rw-r--r--net/ipv6/icmp.c2
-rw-r--r--net/ipv6/inet6_hashtables.c2
-rw-r--r--net/ipv6/proc.c4
-rw-r--r--net/ipv6/route.c11
-rw-r--r--net/irda/af_irda.c30
-rw-r--r--net/key/af_key.c16
-rw-r--r--net/rfkill/rfkill.c5
20 files changed, 113 insertions, 53 deletions
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 0bd657f5dd2a..84672dc57f7a 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -357,7 +357,7 @@ static const struct atmphy_ops idt77105_ops = {
357}; 357};
358 358
359 359
360int __devinit idt77105_init(struct atm_dev *dev) 360int idt77105_init(struct atm_dev *dev)
361{ 361{
362 dev->phy = &idt77105_ops; 362 dev->phy = &idt77105_ops;
363 return 0; 363 return 0;
diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c
index f04f39c00833..b1d063cc4fbe 100644
--- a/drivers/atm/suni.c
+++ b/drivers/atm/suni.c
@@ -289,7 +289,7 @@ static const struct atmphy_ops suni_ops = {
289}; 289};
290 290
291 291
292int __devinit suni_init(struct atm_dev *dev) 292int suni_init(struct atm_dev *dev)
293{ 293{
294 unsigned char mri; 294 unsigned char mri;
295 295
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 0c9a6f7104d2..76c0fa690cc6 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -632,6 +632,7 @@ e1000_down(struct e1000_adapter *adapter)
632 632
633#ifdef CONFIG_E1000_NAPI 633#ifdef CONFIG_E1000_NAPI
634 napi_disable(&adapter->napi); 634 napi_disable(&adapter->napi);
635 atomic_set(&adapter->irq_sem, 0);
635#endif 636#endif
636 e1000_irq_disable(adapter); 637 e1000_irq_disable(adapter);
637 638
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 2ab3bfbb8a63..9cc5a6b01bc1 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2183,6 +2183,7 @@ void e1000e_down(struct e1000_adapter *adapter)
2183 msleep(10); 2183 msleep(10);
2184 2184
2185 napi_disable(&adapter->napi); 2185 napi_disable(&adapter->napi);
2186 atomic_set(&adapter->irq_sem, 0);
2186 e1000_irq_disable(adapter); 2187 e1000_irq_disable(adapter);
2187 2188
2188 del_timer_sync(&adapter->watchdog_timer); 2189 del_timer_sync(&adapter->watchdog_timer);
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index d2fb88d5cda2..4f63839051b0 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -296,6 +296,11 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
296{ 296{
297 struct net_device *netdev = adapter->netdev; 297 struct net_device *netdev = adapter->netdev;
298 298
299#ifdef CONFIG_IXGB_NAPI
300 napi_disable(&adapter->napi);
301 atomic_set(&adapter->irq_sem, 0);
302#endif
303
299 ixgb_irq_disable(adapter); 304 ixgb_irq_disable(adapter);
300 free_irq(adapter->pdev->irq, netdev); 305 free_irq(adapter->pdev->irq, netdev);
301 306
@@ -304,9 +309,7 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
304 309
305 if(kill_watchdog) 310 if(kill_watchdog)
306 del_timer_sync(&adapter->watchdog_timer); 311 del_timer_sync(&adapter->watchdog_timer);
307#ifdef CONFIG_IXGB_NAPI 312
308 napi_disable(&adapter->napi);
309#endif
310 adapter->link_speed = 0; 313 adapter->link_speed = 0;
311 adapter->link_duplex = 0; 314 adapter->link_duplex = 0;
312 netif_carrier_off(netdev); 315 netif_carrier_off(netdev);
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index de3f45e4c5ae..a4265bc1cebb 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1409,9 +1409,11 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
1409 IXGBE_WRITE_FLUSH(&adapter->hw); 1409 IXGBE_WRITE_FLUSH(&adapter->hw);
1410 msleep(10); 1410 msleep(10);
1411 1411
1412 napi_disable(&adapter->napi);
1413 atomic_set(&adapter->irq_sem, 0);
1414
1412 ixgbe_irq_disable(adapter); 1415 ixgbe_irq_disable(adapter);
1413 1416
1414 napi_disable(&adapter->napi);
1415 del_timer_sync(&adapter->watchdog_timer); 1417 del_timer_sync(&adapter->watchdog_timer);
1416 1418
1417 netif_carrier_off(netdev); 1419 netif_carrier_off(netdev);
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 43af9e9b2652..3f67a29593bc 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -459,19 +459,7 @@ static __init int veth_init(void)
459 459
460static __exit void veth_exit(void) 460static __exit void veth_exit(void)
461{ 461{
462 struct veth_priv *priv, *next; 462 rtnl_link_unregister(&veth_link_ops);
463
464 rtnl_lock();
465 /*
466 * cannot trust __rtnl_link_unregister() to unregister all
467 * devices, as each ->dellink call will remove two devices
468 * from the list at once.
469 */
470 list_for_each_entry_safe(priv, next, &veth_list, list)
471 veth_dellink(priv->dev);
472
473 __rtnl_link_unregister(&veth_link_ops);
474 rtnl_unlock();
475} 463}
476 464
477module_init(veth_init); 465module_init(veth_init);
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 5d8b939eded1..9f78a69d6b8b 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -142,6 +142,23 @@ static inline struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb)
142 return skb->nf_bridge; 142 return skb->nf_bridge;
143} 143}
144 144
145static inline struct nf_bridge_info *nf_bridge_unshare(struct sk_buff *skb)
146{
147 struct nf_bridge_info *nf_bridge = skb->nf_bridge;
148
149 if (atomic_read(&nf_bridge->use) > 1) {
150 struct nf_bridge_info *tmp = nf_bridge_alloc(skb);
151
152 if (tmp) {
153 memcpy(tmp, nf_bridge, sizeof(struct nf_bridge_info));
154 atomic_set(&tmp->use, 1);
155 nf_bridge_put(nf_bridge);
156 }
157 nf_bridge = tmp;
158 }
159 return nf_bridge;
160}
161
145static inline void nf_bridge_push_encap_header(struct sk_buff *skb) 162static inline void nf_bridge_push_encap_header(struct sk_buff *skb)
146{ 163{
147 unsigned int len = nf_bridge_encap_header_len(skb); 164 unsigned int len = nf_bridge_encap_header_len(skb);
@@ -637,6 +654,11 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb,
637 if (!skb->nf_bridge) 654 if (!skb->nf_bridge)
638 return NF_ACCEPT; 655 return NF_ACCEPT;
639 656
657 /* Need exclusive nf_bridge_info since we might have multiple
658 * different physoutdevs. */
659 if (!nf_bridge_unshare(skb))
660 return NF_DROP;
661
640 parent = bridge_parent(out); 662 parent = bridge_parent(out);
641 if (!parent) 663 if (!parent)
642 return NF_DROP; 664 return NF_DROP;
@@ -718,6 +740,11 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff *skb,
718 if (!skb->nf_bridge) 740 if (!skb->nf_bridge)
719 return NF_ACCEPT; 741 return NF_ACCEPT;
720 742
743 /* Need exclusive nf_bridge_info since we might have multiple
744 * different physoutdevs. */
745 if (!nf_bridge_unshare(skb))
746 return NF_DROP;
747
721 nf_bridge = skb->nf_bridge; 748 nf_bridge = skb->nf_bridge;
722 if (!(nf_bridge->mask & BRNF_BRIDGED_DNAT)) 749 if (!(nf_bridge->mask & BRNF_BRIDGED_DNAT))
723 return NF_ACCEPT; 750 return NF_ACCEPT;
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index cc8a2f190acf..29b8ee4e35d6 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1316,6 +1316,8 @@ void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms)
1316 *p = parms->next; 1316 *p = parms->next;
1317 parms->dead = 1; 1317 parms->dead = 1;
1318 write_unlock_bh(&tbl->lock); 1318 write_unlock_bh(&tbl->lock);
1319 if (parms->dev)
1320 dev_put(parms->dev);
1319 call_rcu(&parms->rcu_head, neigh_rcu_free_parms); 1321 call_rcu(&parms->rcu_head, neigh_rcu_free_parms);
1320 return; 1322 return;
1321 } 1323 }
@@ -1326,8 +1328,6 @@ void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms)
1326 1328
1327void neigh_parms_destroy(struct neigh_parms *parms) 1329void neigh_parms_destroy(struct neigh_parms *parms)
1328{ 1330{
1329 if (parms->dev)
1330 dev_put(parms->dev);
1331 kfree(parms); 1331 kfree(parms);
1332} 1332}
1333 1333
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index e1ba26fb4bf2..fed95a323b28 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -308,9 +308,12 @@ void __rtnl_link_unregister(struct rtnl_link_ops *ops)
308 struct net *net; 308 struct net *net;
309 309
310 for_each_net(net) { 310 for_each_net(net) {
311restart:
311 for_each_netdev_safe(net, dev, n) { 312 for_each_netdev_safe(net, dev, n) {
312 if (dev->rtnl_link_ops == ops) 313 if (dev->rtnl_link_ops == ops) {
313 ops->dellink(dev); 314 ops->dellink(dev);
315 goto restart;
316 }
314 } 317 }
315 } 318 }
316 list_del(&ops->list); 319 list_del(&ops->list);
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 527a6e0af5b6..0dfee27cfbcd 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -444,6 +444,9 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
444 struct fib_info *fi_drop; 444 struct fib_info *fi_drop;
445 u8 state; 445 u8 state;
446 446
447 if (fi->fib_treeref > 1)
448 goto out;
449
447 write_lock_bh(&fib_hash_lock); 450 write_lock_bh(&fib_hash_lock);
448 fi_drop = fa->fa_info; 451 fi_drop = fa->fa_info;
449 fa->fa_info = fi; 452 fa->fa_info = fi;
@@ -718,19 +721,18 @@ fn_hash_dump_zone(struct sk_buff *skb, struct netlink_callback *cb,
718{ 721{
719 int h, s_h; 722 int h, s_h;
720 723
724 if (fz->fz_hash == NULL)
725 return skb->len;
721 s_h = cb->args[3]; 726 s_h = cb->args[3];
722 for (h=0; h < fz->fz_divisor; h++) { 727 for (h = s_h; h < fz->fz_divisor; h++) {
723 if (h < s_h) continue; 728 if (hlist_empty(&fz->fz_hash[h]))
724 if (h > s_h)
725 memset(&cb->args[4], 0,
726 sizeof(cb->args) - 4*sizeof(cb->args[0]));
727 if (fz->fz_hash == NULL ||
728 hlist_empty(&fz->fz_hash[h]))
729 continue; 729 continue;
730 if (fn_hash_dump_bucket(skb, cb, tb, fz, &fz->fz_hash[h])<0) { 730 if (fn_hash_dump_bucket(skb, cb, tb, fz, &fz->fz_hash[h]) < 0) {
731 cb->args[3] = h; 731 cb->args[3] = h;
732 return -1; 732 return -1;
733 } 733 }
734 memset(&cb->args[4], 0,
735 sizeof(cb->args) - 4*sizeof(cb->args[0]));
734 } 736 }
735 cb->args[3] = h; 737 cb->args[3] = h;
736 return skb->len; 738 return skb->len;
@@ -746,14 +748,13 @@ static int fn_hash_dump(struct fib_table *tb, struct sk_buff *skb, struct netlin
746 read_lock(&fib_hash_lock); 748 read_lock(&fib_hash_lock);
747 for (fz = table->fn_zone_list, m=0; fz; fz = fz->fz_next, m++) { 749 for (fz = table->fn_zone_list, m=0; fz; fz = fz->fz_next, m++) {
748 if (m < s_m) continue; 750 if (m < s_m) continue;
749 if (m > s_m)
750 memset(&cb->args[3], 0,
751 sizeof(cb->args) - 3*sizeof(cb->args[0]));
752 if (fn_hash_dump_zone(skb, cb, tb, fz) < 0) { 751 if (fn_hash_dump_zone(skb, cb, tb, fz) < 0) {
753 cb->args[2] = m; 752 cb->args[2] = m;
754 read_unlock(&fib_hash_lock); 753 read_unlock(&fib_hash_lock);
755 return -1; 754 return -1;
756 } 755 }
756 memset(&cb->args[3], 0,
757 sizeof(cb->args) - 3*sizeof(cb->args[0]));
757 } 758 }
758 read_unlock(&fib_hash_lock); 759 read_unlock(&fib_hash_lock);
759 cb->args[2] = m; 760 cb->args[2] = m;
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 8d8c2915e064..1010b469d7d3 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1214,6 +1214,9 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1214 struct fib_info *fi_drop; 1214 struct fib_info *fi_drop;
1215 u8 state; 1215 u8 state;
1216 1216
1217 if (fi->fib_treeref > 1)
1218 goto out;
1219
1217 err = -ENOBUFS; 1220 err = -ENOBUFS;
1218 new_fa = kmem_cache_alloc(fn_alias_kmem, GFP_KERNEL); 1221 new_fa = kmem_cache_alloc(fn_alias_kmem, GFP_KERNEL);
1219 if (new_fa == NULL) 1222 if (new_fa == NULL)
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 233de0634298..82baea026484 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -540,7 +540,6 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
540 icmp_param.data.icmph.checksum = 0; 540 icmp_param.data.icmph.checksum = 0;
541 icmp_param.skb = skb_in; 541 icmp_param.skb = skb_in;
542 icmp_param.offset = skb_network_offset(skb_in); 542 icmp_param.offset = skb_network_offset(skb_in);
543 icmp_out_count(icmp_param.data.icmph.type);
544 inet_sk(icmp_socket->sk)->tos = tos; 543 inet_sk(icmp_socket->sk)->tos = tos;
545 ipc.addr = iph->saddr; 544 ipc.addr = iph->saddr;
546 ipc.opt = &icmp_param.replyopts; 545 ipc.opt = &icmp_param.replyopts;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 9bb031fa1c2f..f1240688dc58 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -458,8 +458,6 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
458 } 458 }
459 err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr)); 459 err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr));
460 460
461 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS);
462
463out_put: 461out_put:
464 if (likely(idev != NULL)) 462 if (likely(idev != NULL))
465 in6_dev_put(idev); 463 in6_dev_put(idev);
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index adc73adadfae..0765d8bd380f 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -193,7 +193,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
193 sk2->sk_family == PF_INET6 && 193 sk2->sk_family == PF_INET6 &&
194 ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && 194 ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
195 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && 195 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
196 sk2->sk_bound_dev_if == sk->sk_bound_dev_if) { 196 (!sk2->sk_bound_dev_if || sk2->sk_bound_dev_if == dif)) {
197 if (twsk_unique(sk, sk2, twp)) 197 if (twsk_unique(sk, sk2, twp))
198 goto unique; 198 goto unique;
199 else 199 else
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 8631ed7fe8a9..44937616057e 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -88,7 +88,7 @@ static char *icmp6type2name[256] = {
88 [ICMPV6_PKT_TOOBIG] = "PktTooBigs", 88 [ICMPV6_PKT_TOOBIG] = "PktTooBigs",
89 [ICMPV6_TIME_EXCEED] = "TimeExcds", 89 [ICMPV6_TIME_EXCEED] = "TimeExcds",
90 [ICMPV6_PARAMPROB] = "ParmProblems", 90 [ICMPV6_PARAMPROB] = "ParmProblems",
91 [ICMPV6_ECHO_REQUEST] = "EchoRequest", 91 [ICMPV6_ECHO_REQUEST] = "Echos",
92 [ICMPV6_ECHO_REPLY] = "EchoReplies", 92 [ICMPV6_ECHO_REPLY] = "EchoReplies",
93 [ICMPV6_MGM_QUERY] = "GroupMembQueries", 93 [ICMPV6_MGM_QUERY] = "GroupMembQueries",
94 [ICMPV6_MGM_REPORT] = "GroupMembResponses", 94 [ICMPV6_MGM_REPORT] = "GroupMembResponses",
@@ -98,7 +98,7 @@ static char *icmp6type2name[256] = {
98 [NDISC_ROUTER_SOLICITATION] = "RouterSolicits", 98 [NDISC_ROUTER_SOLICITATION] = "RouterSolicits",
99 [NDISC_NEIGHBOUR_ADVERTISEMENT] = "NeighborAdvertisements", 99 [NDISC_NEIGHBOUR_ADVERTISEMENT] = "NeighborAdvertisements",
100 [NDISC_NEIGHBOUR_SOLICITATION] = "NeighborSolicits", 100 [NDISC_NEIGHBOUR_SOLICITATION] = "NeighborSolicits",
101 [NDISC_REDIRECT] = "NeighborRedirects", 101 [NDISC_REDIRECT] = "Redirects",
102}; 102};
103 103
104 104
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6ecb5e6fae2e..20083e0d3995 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -329,7 +329,7 @@ static inline int rt6_check_dev(struct rt6_info *rt, int oif)
329static inline int rt6_check_neigh(struct rt6_info *rt) 329static inline int rt6_check_neigh(struct rt6_info *rt)
330{ 330{
331 struct neighbour *neigh = rt->rt6i_nexthop; 331 struct neighbour *neigh = rt->rt6i_nexthop;
332 int m = 0; 332 int m;
333 if (rt->rt6i_flags & RTF_NONEXTHOP || 333 if (rt->rt6i_flags & RTF_NONEXTHOP ||
334 !(rt->rt6i_flags & RTF_GATEWAY)) 334 !(rt->rt6i_flags & RTF_GATEWAY))
335 m = 1; 335 m = 1;
@@ -337,10 +337,15 @@ static inline int rt6_check_neigh(struct rt6_info *rt)
337 read_lock_bh(&neigh->lock); 337 read_lock_bh(&neigh->lock);
338 if (neigh->nud_state & NUD_VALID) 338 if (neigh->nud_state & NUD_VALID)
339 m = 2; 339 m = 2;
340 else if (!(neigh->nud_state & NUD_FAILED)) 340#ifdef CONFIG_IPV6_ROUTER_PREF
341 else if (neigh->nud_state & NUD_FAILED)
342 m = 0;
343#endif
344 else
341 m = 1; 345 m = 1;
342 read_unlock_bh(&neigh->lock); 346 read_unlock_bh(&neigh->lock);
343 } 347 } else
348 m = 0;
344 return m; 349 return m;
345} 350}
346 351
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index d5e4dd75200b..07dfa7fdd2a0 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -802,12 +802,18 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
802 } 802 }
803#endif /* CONFIG_IRDA_ULTRA */ 803#endif /* CONFIG_IRDA_ULTRA */
804 804
805 self->ias_obj = irias_new_object(addr->sir_name, jiffies);
806 if (self->ias_obj == NULL)
807 return -ENOMEM;
808
805 err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name); 809 err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name);
806 if (err < 0) 810 if (err < 0) {
811 kfree(self->ias_obj->name);
812 kfree(self->ias_obj);
807 return err; 813 return err;
814 }
808 815
809 /* Register with LM-IAS */ 816 /* Register with LM-IAS */
810 self->ias_obj = irias_new_object(addr->sir_name, jiffies);
811 irias_add_integer_attrib(self->ias_obj, "IrDA:TinyTP:LsapSel", 817 irias_add_integer_attrib(self->ias_obj, "IrDA:TinyTP:LsapSel",
812 self->stsap_sel, IAS_KERNEL_ATTR); 818 self->stsap_sel, IAS_KERNEL_ATTR);
813 irias_insert_object(self->ias_obj); 819 irias_insert_object(self->ias_obj);
@@ -1825,7 +1831,7 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1825 struct irda_ias_set *ias_opt; 1831 struct irda_ias_set *ias_opt;
1826 struct ias_object *ias_obj; 1832 struct ias_object *ias_obj;
1827 struct ias_attrib * ias_attr; /* Attribute in IAS object */ 1833 struct ias_attrib * ias_attr; /* Attribute in IAS object */
1828 int opt; 1834 int opt, free_ias = 0;
1829 1835
1830 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); 1836 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);
1831 1837
@@ -1881,11 +1887,20 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1881 /* Create a new object */ 1887 /* Create a new object */
1882 ias_obj = irias_new_object(ias_opt->irda_class_name, 1888 ias_obj = irias_new_object(ias_opt->irda_class_name,
1883 jiffies); 1889 jiffies);
1890 if (ias_obj == NULL) {
1891 kfree(ias_opt);
1892 return -ENOMEM;
1893 }
1894 free_ias = 1;
1884 } 1895 }
1885 1896
1886 /* Do we have the attribute already ? */ 1897 /* Do we have the attribute already ? */
1887 if(irias_find_attrib(ias_obj, ias_opt->irda_attrib_name)) { 1898 if(irias_find_attrib(ias_obj, ias_opt->irda_attrib_name)) {
1888 kfree(ias_opt); 1899 kfree(ias_opt);
1900 if (free_ias) {
1901 kfree(ias_obj->name);
1902 kfree(ias_obj);
1903 }
1889 return -EINVAL; 1904 return -EINVAL;
1890 } 1905 }
1891 1906
@@ -1904,6 +1919,11 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1904 if(ias_opt->attribute.irda_attrib_octet_seq.len > 1919 if(ias_opt->attribute.irda_attrib_octet_seq.len >
1905 IAS_MAX_OCTET_STRING) { 1920 IAS_MAX_OCTET_STRING) {
1906 kfree(ias_opt); 1921 kfree(ias_opt);
1922 if (free_ias) {
1923 kfree(ias_obj->name);
1924 kfree(ias_obj);
1925 }
1926
1907 return -EINVAL; 1927 return -EINVAL;
1908 } 1928 }
1909 /* Add an octet sequence attribute */ 1929 /* Add an octet sequence attribute */
@@ -1932,6 +1952,10 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1932 break; 1952 break;
1933 default : 1953 default :
1934 kfree(ias_opt); 1954 kfree(ias_opt);
1955 if (free_ias) {
1956 kfree(ias_obj->name);
1957 kfree(ias_obj);
1958 }
1935 return -EINVAL; 1959 return -EINVAL;
1936 } 1960 }
1937 irias_insert_object(ias_obj); 1961 irias_insert_object(ias_obj);
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 26d5e63c4cc5..76dcd882f87b 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3593,27 +3593,29 @@ static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
3593 /* old ipsecrequest */ 3593 /* old ipsecrequest */
3594 int mode = pfkey_mode_from_xfrm(mp->mode); 3594 int mode = pfkey_mode_from_xfrm(mp->mode);
3595 if (mode < 0) 3595 if (mode < 0)
3596 return -EINVAL; 3596 goto err;
3597 if (set_ipsecrequest(skb, mp->proto, mode, 3597 if (set_ipsecrequest(skb, mp->proto, mode,
3598 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE), 3598 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
3599 mp->reqid, mp->old_family, 3599 mp->reqid, mp->old_family,
3600 &mp->old_saddr, &mp->old_daddr) < 0) { 3600 &mp->old_saddr, &mp->old_daddr) < 0)
3601 return -EINVAL; 3601 goto err;
3602 }
3603 3602
3604 /* new ipsecrequest */ 3603 /* new ipsecrequest */
3605 if (set_ipsecrequest(skb, mp->proto, mode, 3604 if (set_ipsecrequest(skb, mp->proto, mode,
3606 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE), 3605 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
3607 mp->reqid, mp->new_family, 3606 mp->reqid, mp->new_family,
3608 &mp->new_saddr, &mp->new_daddr) < 0) { 3607 &mp->new_saddr, &mp->new_daddr) < 0)
3609 return -EINVAL; 3608 goto err;
3610 }
3611 } 3609 }
3612 3610
3613 /* broadcast migrate message to sockets */ 3611 /* broadcast migrate message to sockets */
3614 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL); 3612 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL);
3615 3613
3616 return 0; 3614 return 0;
3615
3616err:
3617 kfree_skb(skb);
3618 return -EINVAL;
3617} 3619}
3618#else 3620#else
3619static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 3621static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 4469a7be006c..d06d338812e9 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -392,11 +392,14 @@ int rfkill_register(struct rfkill *rfkill)
392 rfkill_led_trigger_register(rfkill); 392 rfkill_led_trigger_register(rfkill);
393 393
394 error = rfkill_add_switch(rfkill); 394 error = rfkill_add_switch(rfkill);
395 if (error) 395 if (error) {
396 rfkill_led_trigger_unregister(rfkill);
396 return error; 397 return error;
398 }
397 399
398 error = device_add(dev); 400 error = device_add(dev);
399 if (error) { 401 if (error) {
402 rfkill_led_trigger_unregister(rfkill);
400 rfkill_remove_switch(rfkill); 403 rfkill_remove_switch(rfkill);
401 return error; 404 return error;
402 } 405 }