aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ax25/af_ax25.c12
-rw-r--r--net/ax25/ax25_dev.c2
-rw-r--r--net/ax25/ax25_ds_timer.c12
-rw-r--r--net/ax25/ax25_route.c28
-rw-r--r--net/ax25/ax25_timer.c60
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/neighbour.c12
-rw-r--r--net/core/rtnetlink.c36
-rw-r--r--net/core/skbuff.c3
-rw-r--r--net/ipv4/ah4.c2
-rw-r--r--net/ipv4/arp.c3
-rw-r--r--net/ipv4/esp4.c5
-rw-r--r--net/ipv4/fib_trie.c99
-rw-r--r--net/ipv4/inet_hashtables.c3
-rw-r--r--net/ipv4/ip_sockglue.c5
-rw-r--r--net/ipv6/ah6.c2
-rw-r--r--net/ipv6/esp6.c5
-rw-r--r--net/ipv6/ip6_output.c6
-rw-r--r--net/ipv6/xfrm6_output.c2
-rw-r--r--net/key/af_key.c1
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c2
-rw-r--r--net/netfilter/xt_SECMARK.c2
-rw-r--r--net/netlabel/netlabel_domainhash.c6
-rw-r--r--net/netlabel/netlabel_unlabeled.c30
-rw-r--r--net/netlabel/netlabel_user.c3
-rw-r--r--net/netlink/genetlink.c6
-rw-r--r--net/socket.c3
-rw-r--r--net/xfrm/Kconfig2
-rw-r--r--net/xfrm/xfrm_input.c4
-rw-r--r--net/xfrm/xfrm_output.c2
-rw-r--r--net/xfrm/xfrm_user.c1
31 files changed, 210 insertions, 153 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 8fc64e3150a2..48bfcc741f25 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -510,11 +510,7 @@ ax25_cb *ax25_create_cb(void)
510 skb_queue_head_init(&ax25->ack_queue); 510 skb_queue_head_init(&ax25->ack_queue);
511 skb_queue_head_init(&ax25->reseq_queue); 511 skb_queue_head_init(&ax25->reseq_queue);
512 512
513 init_timer(&ax25->timer); 513 ax25_setup_timers(ax25);
514 init_timer(&ax25->t1timer);
515 init_timer(&ax25->t2timer);
516 init_timer(&ax25->t3timer);
517 init_timer(&ax25->idletimer);
518 514
519 ax25_fillin_cb(ax25, NULL); 515 ax25_fillin_cb(ax25, NULL);
520 516
@@ -1928,12 +1924,10 @@ static int ax25_info_show(struct seq_file *seq, void *v)
1928 ax25->paclen); 1924 ax25->paclen);
1929 1925
1930 if (ax25->sk != NULL) { 1926 if (ax25->sk != NULL) {
1931 bh_lock_sock(ax25->sk); 1927 seq_printf(seq, " %d %d %lu\n",
1932 seq_printf(seq," %d %d %ld\n",
1933 atomic_read(&ax25->sk->sk_wmem_alloc), 1928 atomic_read(&ax25->sk->sk_wmem_alloc),
1934 atomic_read(&ax25->sk->sk_rmem_alloc), 1929 atomic_read(&ax25->sk->sk_rmem_alloc),
1935 ax25->sk->sk_socket != NULL ? SOCK_INODE(ax25->sk->sk_socket)->i_ino : 0L); 1930 sock_i_ino(ax25->sk));
1936 bh_unlock_sock(ax25->sk);
1937 } else { 1931 } else {
1938 seq_puts(seq, " * * *\n"); 1932 seq_puts(seq, " * * *\n");
1939 } 1933 }
diff --git a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c
index 528c874d9828..a7a0e0c9698b 100644
--- a/net/ax25/ax25_dev.c
+++ b/net/ax25/ax25_dev.c
@@ -82,7 +82,7 @@ void ax25_dev_device_up(struct net_device *dev)
82 ax25_dev->values[AX25_VALUES_DS_TIMEOUT]= AX25_DEF_DS_TIMEOUT; 82 ax25_dev->values[AX25_VALUES_DS_TIMEOUT]= AX25_DEF_DS_TIMEOUT;
83 83
84#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER) 84#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)
85 init_timer(&ax25_dev->dama.slave_timer); 85 ax25_ds_setup_timer(ax25_dev);
86#endif 86#endif
87 87
88 spin_lock_bh(&ax25_dev_lock); 88 spin_lock_bh(&ax25_dev_lock);
diff --git a/net/ax25/ax25_ds_timer.c b/net/ax25/ax25_ds_timer.c
index c4e3b025d21c..2ce79df00680 100644
--- a/net/ax25/ax25_ds_timer.c
+++ b/net/ax25/ax25_ds_timer.c
@@ -40,13 +40,10 @@ static void ax25_ds_timeout(unsigned long);
40 * 1/10th of a second. 40 * 1/10th of a second.
41 */ 41 */
42 42
43static void ax25_ds_add_timer(ax25_dev *ax25_dev) 43void ax25_ds_setup_timer(ax25_dev *ax25_dev)
44{ 44{
45 struct timer_list *t = &ax25_dev->dama.slave_timer; 45 setup_timer(&ax25_dev->dama.slave_timer, ax25_ds_timeout,
46 t->data = (unsigned long) ax25_dev; 46 (unsigned long)ax25_dev);
47 t->function = &ax25_ds_timeout;
48 t->expires = jiffies + HZ;
49 add_timer(t);
50} 47}
51 48
52void ax25_ds_del_timer(ax25_dev *ax25_dev) 49void ax25_ds_del_timer(ax25_dev *ax25_dev)
@@ -60,10 +57,9 @@ void ax25_ds_set_timer(ax25_dev *ax25_dev)
60 if (ax25_dev == NULL) /* paranoia */ 57 if (ax25_dev == NULL) /* paranoia */
61 return; 58 return;
62 59
63 del_timer(&ax25_dev->dama.slave_timer);
64 ax25_dev->dama.slave_timeout = 60 ax25_dev->dama.slave_timeout =
65 msecs_to_jiffies(ax25_dev->values[AX25_VALUES_DS_TIMEOUT]) / 10; 61 msecs_to_jiffies(ax25_dev->values[AX25_VALUES_DS_TIMEOUT]) / 10;
66 ax25_ds_add_timer(ax25_dev); 62 mod_timer(&ax25_dev->dama.slave_timer, jiffies + HZ);
67} 63}
68 64
69/* 65/*
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index 38c7f3087ec3..8672cd84fdf9 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -45,7 +45,7 @@ void ax25_rt_device_down(struct net_device *dev)
45{ 45{
46 ax25_route *s, *t, *ax25_rt; 46 ax25_route *s, *t, *ax25_rt;
47 47
48 write_lock(&ax25_route_lock); 48 write_lock_bh(&ax25_route_lock);
49 ax25_rt = ax25_route_list; 49 ax25_rt = ax25_route_list;
50 while (ax25_rt != NULL) { 50 while (ax25_rt != NULL) {
51 s = ax25_rt; 51 s = ax25_rt;
@@ -68,7 +68,7 @@ void ax25_rt_device_down(struct net_device *dev)
68 } 68 }
69 } 69 }
70 } 70 }
71 write_unlock(&ax25_route_lock); 71 write_unlock_bh(&ax25_route_lock);
72} 72}
73 73
74static int __must_check ax25_rt_add(struct ax25_routes_struct *route) 74static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
@@ -82,7 +82,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
82 if (route->digi_count > AX25_MAX_DIGIS) 82 if (route->digi_count > AX25_MAX_DIGIS)
83 return -EINVAL; 83 return -EINVAL;
84 84
85 write_lock(&ax25_route_lock); 85 write_lock_bh(&ax25_route_lock);
86 86
87 ax25_rt = ax25_route_list; 87 ax25_rt = ax25_route_list;
88 while (ax25_rt != NULL) { 88 while (ax25_rt != NULL) {
@@ -92,7 +92,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
92 ax25_rt->digipeat = NULL; 92 ax25_rt->digipeat = NULL;
93 if (route->digi_count != 0) { 93 if (route->digi_count != 0) {
94 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { 94 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
95 write_unlock(&ax25_route_lock); 95 write_unlock_bh(&ax25_route_lock);
96 return -ENOMEM; 96 return -ENOMEM;
97 } 97 }
98 ax25_rt->digipeat->lastrepeat = -1; 98 ax25_rt->digipeat->lastrepeat = -1;
@@ -102,14 +102,14 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
102 ax25_rt->digipeat->calls[i] = route->digi_addr[i]; 102 ax25_rt->digipeat->calls[i] = route->digi_addr[i];
103 } 103 }
104 } 104 }
105 write_unlock(&ax25_route_lock); 105 write_unlock_bh(&ax25_route_lock);
106 return 0; 106 return 0;
107 } 107 }
108 ax25_rt = ax25_rt->next; 108 ax25_rt = ax25_rt->next;
109 } 109 }
110 110
111 if ((ax25_rt = kmalloc(sizeof(ax25_route), GFP_ATOMIC)) == NULL) { 111 if ((ax25_rt = kmalloc(sizeof(ax25_route), GFP_ATOMIC)) == NULL) {
112 write_unlock(&ax25_route_lock); 112 write_unlock_bh(&ax25_route_lock);
113 return -ENOMEM; 113 return -ENOMEM;
114 } 114 }
115 115
@@ -120,7 +120,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
120 ax25_rt->ip_mode = ' '; 120 ax25_rt->ip_mode = ' ';
121 if (route->digi_count != 0) { 121 if (route->digi_count != 0) {
122 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { 122 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
123 write_unlock(&ax25_route_lock); 123 write_unlock_bh(&ax25_route_lock);
124 kfree(ax25_rt); 124 kfree(ax25_rt);
125 return -ENOMEM; 125 return -ENOMEM;
126 } 126 }
@@ -133,7 +133,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
133 } 133 }
134 ax25_rt->next = ax25_route_list; 134 ax25_rt->next = ax25_route_list;
135 ax25_route_list = ax25_rt; 135 ax25_route_list = ax25_rt;
136 write_unlock(&ax25_route_lock); 136 write_unlock_bh(&ax25_route_lock);
137 137
138 return 0; 138 return 0;
139} 139}
@@ -152,7 +152,7 @@ static int ax25_rt_del(struct ax25_routes_struct *route)
152 if ((ax25_dev = ax25_addr_ax25dev(&route->port_addr)) == NULL) 152 if ((ax25_dev = ax25_addr_ax25dev(&route->port_addr)) == NULL)
153 return -EINVAL; 153 return -EINVAL;
154 154
155 write_lock(&ax25_route_lock); 155 write_lock_bh(&ax25_route_lock);
156 156
157 ax25_rt = ax25_route_list; 157 ax25_rt = ax25_route_list;
158 while (ax25_rt != NULL) { 158 while (ax25_rt != NULL) {
@@ -174,7 +174,7 @@ static int ax25_rt_del(struct ax25_routes_struct *route)
174 } 174 }
175 } 175 }
176 } 176 }
177 write_unlock(&ax25_route_lock); 177 write_unlock_bh(&ax25_route_lock);
178 178
179 return 0; 179 return 0;
180} 180}
@@ -188,7 +188,7 @@ static int ax25_rt_opt(struct ax25_route_opt_struct *rt_option)
188 if ((ax25_dev = ax25_addr_ax25dev(&rt_option->port_addr)) == NULL) 188 if ((ax25_dev = ax25_addr_ax25dev(&rt_option->port_addr)) == NULL)
189 return -EINVAL; 189 return -EINVAL;
190 190
191 write_lock(&ax25_route_lock); 191 write_lock_bh(&ax25_route_lock);
192 192
193 ax25_rt = ax25_route_list; 193 ax25_rt = ax25_route_list;
194 while (ax25_rt != NULL) { 194 while (ax25_rt != NULL) {
@@ -216,7 +216,7 @@ static int ax25_rt_opt(struct ax25_route_opt_struct *rt_option)
216 } 216 }
217 217
218out: 218out:
219 write_unlock(&ax25_route_lock); 219 write_unlock_bh(&ax25_route_lock);
220 return err; 220 return err;
221} 221}
222 222
@@ -492,7 +492,7 @@ void __exit ax25_rt_free(void)
492{ 492{
493 ax25_route *s, *ax25_rt = ax25_route_list; 493 ax25_route *s, *ax25_rt = ax25_route_list;
494 494
495 write_lock(&ax25_route_lock); 495 write_lock_bh(&ax25_route_lock);
496 while (ax25_rt != NULL) { 496 while (ax25_rt != NULL) {
497 s = ax25_rt; 497 s = ax25_rt;
498 ax25_rt = ax25_rt->next; 498 ax25_rt = ax25_rt->next;
@@ -500,5 +500,5 @@ void __exit ax25_rt_free(void)
500 kfree(s->digipeat); 500 kfree(s->digipeat);
501 kfree(s); 501 kfree(s);
502 } 502 }
503 write_unlock(&ax25_route_lock); 503 write_unlock_bh(&ax25_route_lock);
504} 504}
diff --git a/net/ax25/ax25_timer.c b/net/ax25/ax25_timer.c
index 72594867fab6..db29ea71e80a 100644
--- a/net/ax25/ax25_timer.c
+++ b/net/ax25/ax25_timer.c
@@ -40,63 +40,45 @@ static void ax25_t2timer_expiry(unsigned long);
40static void ax25_t3timer_expiry(unsigned long); 40static void ax25_t3timer_expiry(unsigned long);
41static void ax25_idletimer_expiry(unsigned long); 41static void ax25_idletimer_expiry(unsigned long);
42 42
43void ax25_start_heartbeat(ax25_cb *ax25) 43void ax25_setup_timers(ax25_cb *ax25)
44{ 44{
45 del_timer(&ax25->timer); 45 setup_timer(&ax25->timer, ax25_heartbeat_expiry, (unsigned long)ax25);
46 46 setup_timer(&ax25->t1timer, ax25_t1timer_expiry, (unsigned long)ax25);
47 ax25->timer.data = (unsigned long)ax25; 47 setup_timer(&ax25->t2timer, ax25_t2timer_expiry, (unsigned long)ax25);
48 ax25->timer.function = &ax25_heartbeat_expiry; 48 setup_timer(&ax25->t3timer, ax25_t3timer_expiry, (unsigned long)ax25);
49 ax25->timer.expires = jiffies + 5 * HZ; 49 setup_timer(&ax25->idletimer, ax25_idletimer_expiry,
50 (unsigned long)ax25);
51}
50 52
51 add_timer(&ax25->timer); 53void ax25_start_heartbeat(ax25_cb *ax25)
54{
55 mod_timer(&ax25->timer, jiffies + 5 * HZ);
52} 56}
53 57
54void ax25_start_t1timer(ax25_cb *ax25) 58void ax25_start_t1timer(ax25_cb *ax25)
55{ 59{
56 del_timer(&ax25->t1timer); 60 mod_timer(&ax25->t1timer, jiffies + ax25->t1);
57
58 ax25->t1timer.data = (unsigned long)ax25;
59 ax25->t1timer.function = &ax25_t1timer_expiry;
60 ax25->t1timer.expires = jiffies + ax25->t1;
61
62 add_timer(&ax25->t1timer);
63} 61}
64 62
65void ax25_start_t2timer(ax25_cb *ax25) 63void ax25_start_t2timer(ax25_cb *ax25)
66{ 64{
67 del_timer(&ax25->t2timer); 65 mod_timer(&ax25->t2timer, jiffies + ax25->t2);
68
69 ax25->t2timer.data = (unsigned long)ax25;
70 ax25->t2timer.function = &ax25_t2timer_expiry;
71 ax25->t2timer.expires = jiffies + ax25->t2;
72
73 add_timer(&ax25->t2timer);
74} 66}
75 67
76void ax25_start_t3timer(ax25_cb *ax25) 68void ax25_start_t3timer(ax25_cb *ax25)
77{ 69{
78 del_timer(&ax25->t3timer); 70 if (ax25->t3 > 0)
79 71 mod_timer(&ax25->t3timer, jiffies + ax25->t3);
80 if (ax25->t3 > 0) { 72 else
81 ax25->t3timer.data = (unsigned long)ax25; 73 del_timer(&ax25->t3timer);
82 ax25->t3timer.function = &ax25_t3timer_expiry;
83 ax25->t3timer.expires = jiffies + ax25->t3;
84
85 add_timer(&ax25->t3timer);
86 }
87} 74}
88 75
89void ax25_start_idletimer(ax25_cb *ax25) 76void ax25_start_idletimer(ax25_cb *ax25)
90{ 77{
91 del_timer(&ax25->idletimer); 78 if (ax25->idle > 0)
92 79 mod_timer(&ax25->idletimer, jiffies + ax25->idle);
93 if (ax25->idle > 0) { 80 else
94 ax25->idletimer.data = (unsigned long)ax25; 81 del_timer(&ax25->idletimer);
95 ax25->idletimer.function = &ax25_idletimer_expiry;
96 ax25->idletimer.expires = jiffies + ax25->idle;
97
98 add_timer(&ax25->idletimer);
99 }
100} 82}
101 83
102void ax25_stop_heartbeat(ax25_cb *ax25) 84void ax25_stop_heartbeat(ax25_cb *ax25)
diff --git a/net/core/dev.c b/net/core/dev.c
index b3e19ae57f95..908f07c3bd7d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1071,8 +1071,6 @@ int dev_close(struct net_device *dev)
1071 */ 1071 */
1072 call_netdevice_notifiers(NETDEV_GOING_DOWN, dev); 1072 call_netdevice_notifiers(NETDEV_GOING_DOWN, dev);
1073 1073
1074 dev_deactivate(dev);
1075
1076 clear_bit(__LINK_STATE_START, &dev->state); 1074 clear_bit(__LINK_STATE_START, &dev->state);
1077 1075
1078 /* Synchronize to scheduled poll. We cannot touch poll list, 1076 /* Synchronize to scheduled poll. We cannot touch poll list,
@@ -1083,6 +1081,8 @@ int dev_close(struct net_device *dev)
1083 */ 1081 */
1084 smp_mb__after_clear_bit(); /* Commit netif_running(). */ 1082 smp_mb__after_clear_bit(); /* Commit netif_running(). */
1085 1083
1084 dev_deactivate(dev);
1085
1086 /* 1086 /*
1087 * Call the device specific close. This cannot fail. 1087 * Call the device specific close. This cannot fail.
1088 * Only if device is UP 1088 * Only if device is UP
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index a16cf1ec5e5e..7bb6a9a1256d 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -834,18 +834,12 @@ static void neigh_timer_handler(unsigned long arg)
834 } 834 }
835 if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) { 835 if (neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) {
836 struct sk_buff *skb = skb_peek(&neigh->arp_queue); 836 struct sk_buff *skb = skb_peek(&neigh->arp_queue);
837 /* keep skb alive even if arp_queue overflows */ 837
838 if (skb)
839 skb_get(skb);
840 write_unlock(&neigh->lock);
841 neigh->ops->solicit(neigh, skb); 838 neigh->ops->solicit(neigh, skb);
842 atomic_inc(&neigh->probes); 839 atomic_inc(&neigh->probes);
843 if (skb)
844 kfree_skb(skb);
845 } else {
846out:
847 write_unlock(&neigh->lock);
848 } 840 }
841out:
842 write_unlock(&neigh->lock);
849 843
850 if (notify) 844 if (notify)
851 neigh_update_notify(neigh); 845 neigh_update_notify(neigh);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 61ac8d06292c..ecb02afd52dc 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -504,7 +504,7 @@ int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, u32 id,
504 504
505EXPORT_SYMBOL_GPL(rtnl_put_cacheinfo); 505EXPORT_SYMBOL_GPL(rtnl_put_cacheinfo);
506 506
507static void set_operstate(struct net_device *dev, unsigned char transition) 507static int set_operstate(struct net_device *dev, unsigned char transition, bool send_notification)
508{ 508{
509 unsigned char operstate = dev->operstate; 509 unsigned char operstate = dev->operstate;
510 510
@@ -527,8 +527,12 @@ static void set_operstate(struct net_device *dev, unsigned char transition)
527 write_lock_bh(&dev_base_lock); 527 write_lock_bh(&dev_base_lock);
528 dev->operstate = operstate; 528 dev->operstate = operstate;
529 write_unlock_bh(&dev_base_lock); 529 write_unlock_bh(&dev_base_lock);
530 netdev_state_change(dev); 530
531 } 531 if (send_notification)
532 netdev_state_change(dev);
533 return 1;
534 } else
535 return 0;
532} 536}
533 537
534static void copy_rtnl_link_stats(struct rtnl_link_stats *a, 538static void copy_rtnl_link_stats(struct rtnl_link_stats *a,
@@ -822,6 +826,7 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
822 if (tb[IFLA_BROADCAST]) { 826 if (tb[IFLA_BROADCAST]) {
823 nla_memcpy(dev->broadcast, tb[IFLA_BROADCAST], dev->addr_len); 827 nla_memcpy(dev->broadcast, tb[IFLA_BROADCAST], dev->addr_len);
824 send_addr_notify = 1; 828 send_addr_notify = 1;
829 modified = 1;
825 } 830 }
826 831
827 if (ifm->ifi_flags || ifm->ifi_change) { 832 if (ifm->ifi_flags || ifm->ifi_change) {
@@ -834,16 +839,23 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
834 dev_change_flags(dev, flags); 839 dev_change_flags(dev, flags);
835 } 840 }
836 841
837 if (tb[IFLA_TXQLEN]) 842 if (tb[IFLA_TXQLEN]) {
838 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]); 843 if (dev->tx_queue_len != nla_get_u32(tb[IFLA_TXQLEN])) {
844 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
845 modified = 1;
846 }
847 }
839 848
840 if (tb[IFLA_OPERSTATE]) 849 if (tb[IFLA_OPERSTATE])
841 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE])); 850 modified |= set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]), false);
842 851
843 if (tb[IFLA_LINKMODE]) { 852 if (tb[IFLA_LINKMODE]) {
844 write_lock_bh(&dev_base_lock); 853 if (dev->link_mode != nla_get_u8(tb[IFLA_LINKMODE])) {
845 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]); 854 write_lock_bh(&dev_base_lock);
846 write_unlock_bh(&dev_base_lock); 855 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]);
856 write_lock_bh(&dev_base_lock);
857 modified = 1;
858 }
847 } 859 }
848 860
849 err = 0; 861 err = 0;
@@ -857,6 +869,10 @@ errout:
857 869
858 if (send_addr_notify) 870 if (send_addr_notify)
859 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); 871 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
872
873 if (modified)
874 netdev_state_change(dev);
875
860 return err; 876 return err;
861} 877}
862 878
@@ -974,7 +990,7 @@ struct net_device *rtnl_create_link(struct net *net, char *ifname,
974 if (tb[IFLA_TXQLEN]) 990 if (tb[IFLA_TXQLEN])
975 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]); 991 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
976 if (tb[IFLA_OPERSTATE]) 992 if (tb[IFLA_OPERSTATE])
977 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE])); 993 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]), true);
978 if (tb[IFLA_LINKMODE]) 994 if (tb[IFLA_LINKMODE])
979 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]); 995 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]);
980 996
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index cfc07dac636c..0d0fd28a9041 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2106,11 +2106,10 @@ int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
2106/** 2106/**
2107 * skb_pull_rcsum - pull skb and update receive checksum 2107 * skb_pull_rcsum - pull skb and update receive checksum
2108 * @skb: buffer to update 2108 * @skb: buffer to update
2109 * @start: start of data before pull
2110 * @len: length of data pulled 2109 * @len: length of data pulled
2111 * 2110 *
2112 * This function performs an skb_pull on the packet and updates 2111 * This function performs an skb_pull on the packet and updates
2113 * update the CHECKSUM_COMPLETE checksum. It should be used on 2112 * the CHECKSUM_COMPLETE checksum. It should be used on
2114 * receive path processing instead of skb_pull unless you know 2113 * receive path processing instead of skb_pull unless you know
2115 * that the checksum difference is zero (e.g., a valid IP header) 2114 * that the checksum difference is zero (e.g., a valid IP header)
2116 * or you are setting ip_summed to CHECKSUM_NONE. 2115 * or you are setting ip_summed to CHECKSUM_NONE.
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index 9d4555ec0b59..8219b7e0968d 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -96,7 +96,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb)
96 96
97 ah->reserved = 0; 97 ah->reserved = 0;
98 ah->spi = x->id.spi; 98 ah->spi = x->id.spi;
99 ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq); 99 ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output);
100 100
101 spin_lock_bh(&x->lock); 101 spin_lock_bh(&x->lock);
102 err = ah_mac_digest(ahp, skb, ah->auth_data); 102 err = ah_mac_digest(ahp, skb, ah->auth_data);
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 8e17f65f4002..c663fa5339ee 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -368,7 +368,6 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
368 if (!(neigh->nud_state&NUD_VALID)) 368 if (!(neigh->nud_state&NUD_VALID))
369 printk(KERN_DEBUG "trying to ucast probe in NUD_INVALID\n"); 369 printk(KERN_DEBUG "trying to ucast probe in NUD_INVALID\n");
370 dst_ha = neigh->ha; 370 dst_ha = neigh->ha;
371 read_lock_bh(&neigh->lock);
372 } else if ((probes -= neigh->parms->app_probes) < 0) { 371 } else if ((probes -= neigh->parms->app_probes) < 0) {
373#ifdef CONFIG_ARPD 372#ifdef CONFIG_ARPD
374 neigh_app_ns(neigh); 373 neigh_app_ns(neigh);
@@ -378,8 +377,6 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
378 377
379 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr, 378 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
380 dst_ha, dev->dev_addr, NULL); 379 dst_ha, dev->dev_addr, NULL);
381 if (dst_ha)
382 read_unlock_bh(&neigh->lock);
383} 380}
384 381
385static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip) 382static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 258d17631b4b..091e6709f831 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -199,7 +199,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
199 } 199 }
200 200
201 esph->spi = x->id.spi; 201 esph->spi = x->id.spi;
202 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq); 202 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output);
203 203
204 sg_init_table(sg, nfrags); 204 sg_init_table(sg, nfrags);
205 skb_to_sgvec(skb, sg, 205 skb_to_sgvec(skb, sg,
@@ -210,7 +210,8 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
210 aead_givcrypt_set_callback(req, 0, esp_output_done, skb); 210 aead_givcrypt_set_callback(req, 0, esp_output_done, skb);
211 aead_givcrypt_set_crypt(req, sg, sg, clen, iv); 211 aead_givcrypt_set_crypt(req, sg, sg, clen, iv);
212 aead_givcrypt_set_assoc(req, asg, sizeof(*esph)); 212 aead_givcrypt_set_assoc(req, asg, sizeof(*esph));
213 aead_givcrypt_set_giv(req, esph->enc_data, XFRM_SKB_CB(skb)->seq); 213 aead_givcrypt_set_giv(req, esph->enc_data,
214 XFRM_SKB_CB(skb)->seq.output);
214 215
215 ESP_SKB_CB(skb)->tmp = tmp; 216 ESP_SKB_CB(skb)->tmp = tmp;
216 err = crypto_aead_givencrypt(req); 217 err = crypto_aead_givencrypt(req);
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index f5fba3f71c06..1ff446d0fa8b 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1762,11 +1762,9 @@ static struct leaf *trie_leafindex(struct trie *t, int index)
1762{ 1762{
1763 struct leaf *l = trie_firstleaf(t); 1763 struct leaf *l = trie_firstleaf(t);
1764 1764
1765 while (index-- > 0) { 1765 while (l && index-- > 0)
1766 l = trie_nextleaf(l); 1766 l = trie_nextleaf(l);
1767 if (!l) 1767
1768 break;
1769 }
1770 return l; 1768 return l;
1771} 1769}
1772 1770
@@ -2461,6 +2459,84 @@ static const struct file_operations fib_trie_fops = {
2461 .release = seq_release_net, 2459 .release = seq_release_net,
2462}; 2460};
2463 2461
2462struct fib_route_iter {
2463 struct seq_net_private p;
2464 struct trie *main_trie;
2465 loff_t pos;
2466 t_key key;
2467};
2468
2469static struct leaf *fib_route_get_idx(struct fib_route_iter *iter, loff_t pos)
2470{
2471 struct leaf *l = NULL;
2472 struct trie *t = iter->main_trie;
2473
2474 /* use cache location of last found key */
2475 if (iter->pos > 0 && pos >= iter->pos && (l = fib_find_node(t, iter->key)))
2476 pos -= iter->pos;
2477 else {
2478 iter->pos = 0;
2479 l = trie_firstleaf(t);
2480 }
2481
2482 while (l && pos-- > 0) {
2483 iter->pos++;
2484 l = trie_nextleaf(l);
2485 }
2486
2487 if (l)
2488 iter->key = pos; /* remember it */
2489 else
2490 iter->pos = 0; /* forget it */
2491
2492 return l;
2493}
2494
2495static void *fib_route_seq_start(struct seq_file *seq, loff_t *pos)
2496 __acquires(RCU)
2497{
2498 struct fib_route_iter *iter = seq->private;
2499 struct fib_table *tb;
2500
2501 rcu_read_lock();
2502 tb = fib_get_table(iter->p.net, RT_TABLE_MAIN);
2503 if (!tb)
2504 return NULL;
2505
2506 iter->main_trie = (struct trie *) tb->tb_data;
2507 if (*pos == 0)
2508 return SEQ_START_TOKEN;
2509 else
2510 return fib_route_get_idx(iter, *pos - 1);
2511}
2512
2513static void *fib_route_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2514{
2515 struct fib_route_iter *iter = seq->private;
2516 struct leaf *l = v;
2517
2518 ++*pos;
2519 if (v == SEQ_START_TOKEN) {
2520 iter->pos = 0;
2521 l = trie_firstleaf(iter->main_trie);
2522 } else {
2523 iter->pos++;
2524 l = trie_nextleaf(l);
2525 }
2526
2527 if (l)
2528 iter->key = l->key;
2529 else
2530 iter->pos = 0;
2531 return l;
2532}
2533
2534static void fib_route_seq_stop(struct seq_file *seq, void *v)
2535 __releases(RCU)
2536{
2537 rcu_read_unlock();
2538}
2539
2464static unsigned fib_flag_trans(int type, __be32 mask, const struct fib_info *fi) 2540static unsigned fib_flag_trans(int type, __be32 mask, const struct fib_info *fi)
2465{ 2541{
2466 static unsigned type2flags[RTN_MAX + 1] = { 2542 static unsigned type2flags[RTN_MAX + 1] = {
@@ -2484,7 +2560,6 @@ static unsigned fib_flag_trans(int type, __be32 mask, const struct fib_info *fi)
2484 */ 2560 */
2485static int fib_route_seq_show(struct seq_file *seq, void *v) 2561static int fib_route_seq_show(struct seq_file *seq, void *v)
2486{ 2562{
2487 const struct fib_trie_iter *iter = seq->private;
2488 struct leaf *l = v; 2563 struct leaf *l = v;
2489 struct leaf_info *li; 2564 struct leaf_info *li;
2490 struct hlist_node *node; 2565 struct hlist_node *node;
@@ -2496,12 +2571,6 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
2496 return 0; 2571 return 0;
2497 } 2572 }
2498 2573
2499 if (iter->trie == iter->trie_local)
2500 return 0;
2501
2502 if (IS_TNODE(l))
2503 return 0;
2504
2505 hlist_for_each_entry_rcu(li, node, &l->list, hlist) { 2574 hlist_for_each_entry_rcu(li, node, &l->list, hlist) {
2506 struct fib_alias *fa; 2575 struct fib_alias *fa;
2507 __be32 mask, prefix; 2576 __be32 mask, prefix;
@@ -2544,16 +2613,16 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
2544} 2613}
2545 2614
2546static const struct seq_operations fib_route_seq_ops = { 2615static const struct seq_operations fib_route_seq_ops = {
2547 .start = fib_trie_seq_start, 2616 .start = fib_route_seq_start,
2548 .next = fib_trie_seq_next, 2617 .next = fib_route_seq_next,
2549 .stop = fib_trie_seq_stop, 2618 .stop = fib_route_seq_stop,
2550 .show = fib_route_seq_show, 2619 .show = fib_route_seq_show,
2551}; 2620};
2552 2621
2553static int fib_route_seq_open(struct inode *inode, struct file *file) 2622static int fib_route_seq_open(struct inode *inode, struct file *file)
2554{ 2623{
2555 return seq_open_net(inode, file, &fib_route_seq_ops, 2624 return seq_open_net(inode, file, &fib_route_seq_ops,
2556 sizeof(struct fib_trie_iter)); 2625 sizeof(struct fib_route_iter));
2557} 2626}
2558 2627
2559static const struct file_operations fib_route_fops = { 2628static const struct file_operations fib_route_fops = {
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 9cac6c034abd..1aba606f6bbb 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -120,8 +120,6 @@ void inet_listen_wlock(struct inet_hashinfo *hashinfo)
120 } 120 }
121} 121}
122 122
123EXPORT_SYMBOL(inet_listen_wlock);
124
125/* 123/*
126 * Don't inline this cruft. Here are some nice properties to exploit here. The 124 * Don't inline this cruft. Here are some nice properties to exploit here. The
127 * BSD API does not allow a listening sock to specify the remote port nor the 125 * BSD API does not allow a listening sock to specify the remote port nor the
@@ -494,7 +492,6 @@ out:
494 return ret; 492 return ret;
495 } 493 }
496} 494}
497EXPORT_SYMBOL_GPL(__inet_hash_connect);
498 495
499/* 496/*
500 * Bind a port for a connect operation and hash it. 497 * Bind a port for a connect operation and hash it.
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 754b0a5bbfe9..de0572c88859 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -514,11 +514,6 @@ static int do_ip_setsockopt(struct sock *sk, int level,
514 val &= ~3; 514 val &= ~3;
515 val |= inet->tos & 3; 515 val |= inet->tos & 3;
516 } 516 }
517 if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP &&
518 !capable(CAP_NET_ADMIN)) {
519 err = -EPERM;
520 break;
521 }
522 if (inet->tos != val) { 517 if (inet->tos != val) {
523 inet->tos = val; 518 inet->tos = val;
524 sk->sk_priority = rt_tos2priority(val); 519 sk->sk_priority = rt_tos2priority(val);
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 379c8e04c36c..2ff0c8233e47 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -283,7 +283,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
283 283
284 ah->reserved = 0; 284 ah->reserved = 0;
285 ah->spi = x->id.spi; 285 ah->spi = x->id.spi;
286 ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq); 286 ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output);
287 287
288 spin_lock_bh(&x->lock); 288 spin_lock_bh(&x->lock);
289 err = ah_mac_digest(ahp, skb, ah->auth_data); 289 err = ah_mac_digest(ahp, skb, ah->auth_data);
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 8e0f1428c716..0ec1402320ea 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -188,7 +188,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
188 *skb_mac_header(skb) = IPPROTO_ESP; 188 *skb_mac_header(skb) = IPPROTO_ESP;
189 189
190 esph->spi = x->id.spi; 190 esph->spi = x->id.spi;
191 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq); 191 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.output);
192 192
193 sg_init_table(sg, nfrags); 193 sg_init_table(sg, nfrags);
194 skb_to_sgvec(skb, sg, 194 skb_to_sgvec(skb, sg,
@@ -199,7 +199,8 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
199 aead_givcrypt_set_callback(req, 0, esp_output_done, skb); 199 aead_givcrypt_set_callback(req, 0, esp_output_done, skb);
200 aead_givcrypt_set_crypt(req, sg, sg, clen, iv); 200 aead_givcrypt_set_crypt(req, sg, sg, clen, iv);
201 aead_givcrypt_set_assoc(req, asg, sizeof(*esph)); 201 aead_givcrypt_set_assoc(req, asg, sizeof(*esph));
202 aead_givcrypt_set_giv(req, esph->enc_data, XFRM_SKB_CB(skb)->seq); 202 aead_givcrypt_set_giv(req, esph->enc_data,
203 XFRM_SKB_CB(skb)->seq.output);
203 204
204 ESP_SKB_CB(skb)->tmp = tmp; 205 ESP_SKB_CB(skb)->tmp = tmp;
205 err = crypto_aead_givencrypt(req); 206 err = crypto_aead_givencrypt(req);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 9ac6ca2521c3..8b67ca07467d 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -621,7 +621,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
621 * or if the skb it not generated by a local socket. (This last 621 * or if the skb it not generated by a local socket. (This last
622 * check should be redundant, but it's free.) 622 * check should be redundant, but it's free.)
623 */ 623 */
624 if (!np || np->pmtudisc >= IPV6_PMTUDISC_DO) { 624 if (!skb->local_df) {
625 skb->dev = skb->dst->dev; 625 skb->dev = skb->dst->dev;
626 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); 626 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
627 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); 627 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS);
@@ -1420,6 +1420,10 @@ int ip6_push_pending_frames(struct sock *sk)
1420 tmp_skb->sk = NULL; 1420 tmp_skb->sk = NULL;
1421 } 1421 }
1422 1422
1423 /* Allow local fragmentation. */
1424 if (np->pmtudisc < IPV6_PMTUDISC_DO)
1425 skb->local_df = 1;
1426
1423 ipv6_addr_copy(final_dst, &fl->fl6_dst); 1427 ipv6_addr_copy(final_dst, &fl->fl6_dst);
1424 __skb_pull(skb, skb_network_header_len(skb)); 1428 __skb_pull(skb, skb_network_header_len(skb));
1425 if (opt && opt->opt_flen) 1429 if (opt && opt->opt_flen)
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index b34c58c65656..79ccfb080733 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -36,7 +36,7 @@ static int xfrm6_tunnel_check_size(struct sk_buff *skb)
36 if (mtu < IPV6_MIN_MTU) 36 if (mtu < IPV6_MIN_MTU)
37 mtu = IPV6_MIN_MTU; 37 mtu = IPV6_MIN_MTU;
38 38
39 if (skb->len > mtu) { 39 if (!skb->local_df && skb->len > mtu) {
40 skb->dev = dst->dev; 40 skb->dev = dst->dev;
41 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); 41 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
42 ret = -EMSGSIZE; 42 ret = -EMSGSIZE;
diff --git a/net/key/af_key.c b/net/key/af_key.c
index b3ac85e808ac..1c853927810a 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2291,6 +2291,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2291 return 0; 2291 return 0;
2292 2292
2293out: 2293out:
2294 xp->dead = 1;
2294 xfrm_policy_destroy(xp); 2295 xfrm_policy_destroy(xp);
2295 return err; 2296 return err;
2296} 2297}
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 202d7fa09483..62567959b66e 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -945,7 +945,7 @@ static int tcp_packet(struct nf_conn *ct,
945 945
946 ct->proto.tcp.state = new_state; 946 ct->proto.tcp.state = new_state;
947 if (old_state != new_state 947 if (old_state != new_state
948 && new_state == TCP_CONNTRACK_CLOSE) 948 && new_state == TCP_CONNTRACK_FIN_WAIT)
949 ct->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT; 949 ct->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT;
950 timeout = ct->proto.tcp.retrans >= nf_ct_tcp_max_retrans 950 timeout = ct->proto.tcp.retrans >= nf_ct_tcp_max_retrans
951 && tcp_timeouts[new_state] > nf_ct_tcp_timeout_max_retrans 951 && tcp_timeouts[new_state] > nf_ct_tcp_timeout_max_retrans
diff --git a/net/netfilter/xt_SECMARK.c b/net/netfilter/xt_SECMARK.c
index 7708e2084ce2..c0284856ccd4 100644
--- a/net/netfilter/xt_SECMARK.c
+++ b/net/netfilter/xt_SECMARK.c
@@ -111,7 +111,7 @@ secmark_tg_check(const char *tablename, const void *entry,
111 return true; 111 return true;
112} 112}
113 113
114void secmark_tg_destroy(const struct xt_target *target, void *targinfo) 114static void secmark_tg_destroy(const struct xt_target *target, void *targinfo)
115{ 115{
116 switch (mode) { 116 switch (mode) {
117 case SECMARK_MODE_SEL: 117 case SECMARK_MODE_SEL:
diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
index 9a8ea0195c4f..fd462313471c 100644
--- a/net/netlabel/netlabel_domainhash.c
+++ b/net/netlabel/netlabel_domainhash.c
@@ -150,11 +150,11 @@ static struct netlbl_dom_map *netlbl_domhsh_search_def(const char *domain)
150 entry = netlbl_domhsh_search(domain); 150 entry = netlbl_domhsh_search(domain);
151 if (entry == NULL) { 151 if (entry == NULL) {
152 entry = rcu_dereference(netlbl_domhsh_def); 152 entry = rcu_dereference(netlbl_domhsh_def);
153 if (entry != NULL && entry->valid) 153 if (entry != NULL && !entry->valid)
154 return entry; 154 entry = NULL;
155 } 155 }
156 156
157 return NULL; 157 return entry;
158} 158}
159 159
160/* 160/*
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 42e81fd8cc49..3e745b72fded 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -180,6 +180,7 @@ static void netlbl_unlabel_audit_addr4(struct audit_buffer *audit_buf,
180 } 180 }
181} 181}
182 182
183#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
183/** 184/**
184 * netlbl_unlabel_audit_addr6 - Audit an IPv6 address 185 * netlbl_unlabel_audit_addr6 - Audit an IPv6 address
185 * @audit_buf: audit buffer 186 * @audit_buf: audit buffer
@@ -213,6 +214,7 @@ static void netlbl_unlabel_audit_addr6(struct audit_buffer *audit_buf,
213 audit_log_format(audit_buf, " src_prefixlen=%d", mask_len); 214 audit_log_format(audit_buf, " src_prefixlen=%d", mask_len);
214 } 215 }
215} 216}
217#endif /* IPv6 */
216 218
217/* 219/*
218 * Unlabeled Connection Hash Table Functions 220 * Unlabeled Connection Hash Table Functions
@@ -617,8 +619,6 @@ static int netlbl_unlhsh_add(struct net *net,
617 int ifindex; 619 int ifindex;
618 struct net_device *dev; 620 struct net_device *dev;
619 struct netlbl_unlhsh_iface *iface; 621 struct netlbl_unlhsh_iface *iface;
620 struct in_addr *addr4, *mask4;
621 struct in6_addr *addr6, *mask6;
622 struct audit_buffer *audit_buf = NULL; 622 struct audit_buffer *audit_buf = NULL;
623 char *secctx = NULL; 623 char *secctx = NULL;
624 u32 secctx_len; 624 u32 secctx_len;
@@ -651,7 +651,9 @@ static int netlbl_unlhsh_add(struct net *net,
651 audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCADD, 651 audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCADD,
652 audit_info); 652 audit_info);
653 switch (addr_len) { 653 switch (addr_len) {
654 case sizeof(struct in_addr): 654 case sizeof(struct in_addr): {
655 struct in_addr *addr4, *mask4;
656
655 addr4 = (struct in_addr *)addr; 657 addr4 = (struct in_addr *)addr;
656 mask4 = (struct in_addr *)mask; 658 mask4 = (struct in_addr *)mask;
657 ret_val = netlbl_unlhsh_add_addr4(iface, addr4, mask4, secid); 659 ret_val = netlbl_unlhsh_add_addr4(iface, addr4, mask4, secid);
@@ -661,8 +663,11 @@ static int netlbl_unlhsh_add(struct net *net,
661 addr4->s_addr, 663 addr4->s_addr,
662 mask4->s_addr); 664 mask4->s_addr);
663 break; 665 break;
666 }
664#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 667#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
665 case sizeof(struct in6_addr): 668 case sizeof(struct in6_addr): {
669 struct in6_addr *addr6, *mask6;
670
666 addr6 = (struct in6_addr *)addr; 671 addr6 = (struct in6_addr *)addr;
667 mask6 = (struct in6_addr *)mask; 672 mask6 = (struct in6_addr *)mask;
668 ret_val = netlbl_unlhsh_add_addr6(iface, addr6, mask6, secid); 673 ret_val = netlbl_unlhsh_add_addr6(iface, addr6, mask6, secid);
@@ -671,6 +676,7 @@ static int netlbl_unlhsh_add(struct net *net,
671 dev_name, 676 dev_name,
672 addr6, mask6); 677 addr6, mask6);
673 break; 678 break;
679 }
674#endif /* IPv6 */ 680#endif /* IPv6 */
675 default: 681 default:
676 ret_val = -EINVAL; 682 ret_val = -EINVAL;
@@ -1741,10 +1747,6 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
1741 u16 family, 1747 u16 family,
1742 struct netlbl_lsm_secattr *secattr) 1748 struct netlbl_lsm_secattr *secattr)
1743{ 1749{
1744 struct iphdr *hdr4;
1745 struct ipv6hdr *hdr6;
1746 struct netlbl_unlhsh_addr4 *addr4;
1747 struct netlbl_unlhsh_addr6 *addr6;
1748 struct netlbl_unlhsh_iface *iface; 1750 struct netlbl_unlhsh_iface *iface;
1749 1751
1750 rcu_read_lock(); 1752 rcu_read_lock();
@@ -1752,21 +1754,29 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
1752 if (iface == NULL) 1754 if (iface == NULL)
1753 goto unlabel_getattr_nolabel; 1755 goto unlabel_getattr_nolabel;
1754 switch (family) { 1756 switch (family) {
1755 case PF_INET: 1757 case PF_INET: {
1758 struct iphdr *hdr4;
1759 struct netlbl_unlhsh_addr4 *addr4;
1760
1756 hdr4 = ip_hdr(skb); 1761 hdr4 = ip_hdr(skb);
1757 addr4 = netlbl_unlhsh_search_addr4(hdr4->saddr, iface); 1762 addr4 = netlbl_unlhsh_search_addr4(hdr4->saddr, iface);
1758 if (addr4 == NULL) 1763 if (addr4 == NULL)
1759 goto unlabel_getattr_nolabel; 1764 goto unlabel_getattr_nolabel;
1760 secattr->attr.secid = addr4->secid; 1765 secattr->attr.secid = addr4->secid;
1761 break; 1766 break;
1767 }
1762#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1768#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
1763 case PF_INET6: 1769 case PF_INET6: {
1770 struct ipv6hdr *hdr6;
1771 struct netlbl_unlhsh_addr6 *addr6;
1772
1764 hdr6 = ipv6_hdr(skb); 1773 hdr6 = ipv6_hdr(skb);
1765 addr6 = netlbl_unlhsh_search_addr6(&hdr6->saddr, iface); 1774 addr6 = netlbl_unlhsh_search_addr6(&hdr6->saddr, iface);
1766 if (addr6 == NULL) 1775 if (addr6 == NULL)
1767 goto unlabel_getattr_nolabel; 1776 goto unlabel_getattr_nolabel;
1768 secattr->attr.secid = addr6->secid; 1777 secattr->attr.secid = addr6->secid;
1769 break; 1778 break;
1779 }
1770#endif /* IPv6 */ 1780#endif /* IPv6 */
1771 default: 1781 default:
1772 goto unlabel_getattr_nolabel; 1782 goto unlabel_getattr_nolabel;
diff --git a/net/netlabel/netlabel_user.c b/net/netlabel/netlabel_user.c
index 85a96a3fddaa..023fc8fe840d 100644
--- a/net/netlabel/netlabel_user.c
+++ b/net/netlabel/netlabel_user.c
@@ -96,7 +96,6 @@ int netlbl_netlink_init(void)
96struct audit_buffer *netlbl_audit_start_common(int type, 96struct audit_buffer *netlbl_audit_start_common(int type,
97 struct netlbl_audit *audit_info) 97 struct netlbl_audit *audit_info)
98{ 98{
99 struct audit_context *audit_ctx = current->audit_context;
100 struct audit_buffer *audit_buf; 99 struct audit_buffer *audit_buf;
101 char *secctx; 100 char *secctx;
102 u32 secctx_len; 101 u32 secctx_len;
@@ -104,7 +103,7 @@ struct audit_buffer *netlbl_audit_start_common(int type,
104 if (audit_enabled == 0) 103 if (audit_enabled == 0)
105 return NULL; 104 return NULL;
106 105
107 audit_buf = audit_log_start(audit_ctx, GFP_ATOMIC, type); 106 audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, type);
108 if (audit_buf == NULL) 107 if (audit_buf == NULL)
109 return NULL; 108 return NULL;
110 109
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 150579a21469..d16929c9b4bc 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -230,10 +230,8 @@ static void genl_unregister_mc_groups(struct genl_family *family)
230{ 230{
231 struct genl_multicast_group *grp, *tmp; 231 struct genl_multicast_group *grp, *tmp;
232 232
233 genl_lock();
234 list_for_each_entry_safe(grp, tmp, &family->mcast_groups, list) 233 list_for_each_entry_safe(grp, tmp, &family->mcast_groups, list)
235 __genl_unregister_mc_group(family, grp); 234 __genl_unregister_mc_group(family, grp);
236 genl_unlock();
237} 235}
238 236
239/** 237/**
@@ -396,10 +394,10 @@ int genl_unregister_family(struct genl_family *family)
396{ 394{
397 struct genl_family *rc; 395 struct genl_family *rc;
398 396
399 genl_unregister_mc_groups(family);
400
401 genl_lock(); 397 genl_lock();
402 398
399 genl_unregister_mc_groups(family);
400
403 list_for_each_entry(rc, genl_family_chain(family->id), family_list) { 401 list_for_each_entry(rc, genl_family_chain(family->id), family_list) {
404 if (family->id != rc->id || strcmp(rc->name, family->name)) 402 if (family->id != rc->id || strcmp(rc->name, family->name))
405 continue; 403 continue;
diff --git a/net/socket.c b/net/socket.c
index 7651de008502..b6d35cd72a50 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -701,6 +701,9 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
701{ 701{
702 struct socket *sock = file->private_data; 702 struct socket *sock = file->private_data;
703 703
704 if (unlikely(!sock->ops->splice_read))
705 return -EINVAL;
706
704 return sock->ops->splice_read(sock, ppos, pipe, len, flags); 707 return sock->ops->splice_read(sock, ppos, pipe, len, flags);
705} 708}
706 709
diff --git a/net/xfrm/Kconfig b/net/xfrm/Kconfig
index 8f9dbec319be..9201ef8ad90e 100644
--- a/net/xfrm/Kconfig
+++ b/net/xfrm/Kconfig
@@ -38,7 +38,7 @@ config XFRM_MIGRATE
38 38
39config XFRM_STATISTICS 39config XFRM_STATISTICS
40 bool "Transformation statistics (EXPERIMENTAL)" 40 bool "Transformation statistics (EXPERIMENTAL)"
41 depends on XFRM && PROC_FS && EXPERIMENTAL 41 depends on INET && XFRM && PROC_FS && EXPERIMENTAL
42 ---help--- 42 ---help---
43 This statistics is not a SNMP/MIB specification but shows 43 This statistics is not a SNMP/MIB specification but shows
44 statistics about transformation error (or almost error) factor 44 statistics about transformation error (or almost error) factor
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 4d6ebc633a94..62188c6a06dd 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -109,7 +109,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
109 if (encap_type < 0) { 109 if (encap_type < 0) {
110 async = 1; 110 async = 1;
111 x = xfrm_input_state(skb); 111 x = xfrm_input_state(skb);
112 seq = XFRM_SKB_CB(skb)->seq; 112 seq = XFRM_SKB_CB(skb)->seq.input;
113 goto resume; 113 goto resume;
114 } 114 }
115 115
@@ -175,7 +175,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
175 175
176 spin_unlock(&x->lock); 176 spin_unlock(&x->lock);
177 177
178 XFRM_SKB_CB(skb)->seq = seq; 178 XFRM_SKB_CB(skb)->seq.input = seq;
179 179
180 nexthdr = x->type->input(x, skb); 180 nexthdr = x->type->input(x, skb);
181 181
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index fc690368325f..569d377932c4 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -62,7 +62,7 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
62 } 62 }
63 63
64 if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { 64 if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
65 XFRM_SKB_CB(skb)->seq = ++x->replay.oseq; 65 XFRM_SKB_CB(skb)->seq.output = ++x->replay.oseq;
66 if (unlikely(x->replay.oseq == 0)) { 66 if (unlikely(x->replay.oseq == 0)) {
67 XFRM_INC_STATS(LINUX_MIB_XFRMOUTSTATESEQERROR); 67 XFRM_INC_STATS(LINUX_MIB_XFRMOUTSTATESEQERROR);
68 x->replay.oseq--; 68 x->replay.oseq--;
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 78338079b7f5..f971ca5645f8 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1105,6 +1105,7 @@ static struct xfrm_policy *xfrm_policy_construct(struct xfrm_userpolicy_info *p,
1105 return xp; 1105 return xp;
1106 error: 1106 error:
1107 *errp = err; 1107 *errp = err;
1108 xp->dead = 1;
1108 xfrm_policy_destroy(xp); 1109 xfrm_policy_destroy(xp);
1109 return NULL; 1110 return NULL;
1110} 1111}