diff options
Diffstat (limited to 'net')
47 files changed, 270 insertions, 211 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 91d3d96805d0..b12dae2b0b2d 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1029,6 +1029,11 @@ skip: | |||
1029 | } | 1029 | } |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | static inline bool inetdev_valid_mtu(unsigned mtu) | ||
1033 | { | ||
1034 | return mtu >= 68; | ||
1035 | } | ||
1036 | |||
1032 | /* Called only under RTNL semaphore */ | 1037 | /* Called only under RTNL semaphore */ |
1033 | 1038 | ||
1034 | static int inetdev_event(struct notifier_block *this, unsigned long event, | 1039 | static int inetdev_event(struct notifier_block *this, unsigned long event, |
@@ -1048,6 +1053,10 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
1048 | IN_DEV_CONF_SET(in_dev, NOXFRM, 1); | 1053 | IN_DEV_CONF_SET(in_dev, NOXFRM, 1); |
1049 | IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); | 1054 | IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); |
1050 | } | 1055 | } |
1056 | } else if (event == NETDEV_CHANGEMTU) { | ||
1057 | /* Re-enabling IP */ | ||
1058 | if (inetdev_valid_mtu(dev->mtu)) | ||
1059 | in_dev = inetdev_init(dev); | ||
1051 | } | 1060 | } |
1052 | goto out; | 1061 | goto out; |
1053 | } | 1062 | } |
@@ -1058,7 +1067,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
1058 | dev->ip_ptr = NULL; | 1067 | dev->ip_ptr = NULL; |
1059 | break; | 1068 | break; |
1060 | case NETDEV_UP: | 1069 | case NETDEV_UP: |
1061 | if (dev->mtu < 68) | 1070 | if (!inetdev_valid_mtu(dev->mtu)) |
1062 | break; | 1071 | break; |
1063 | if (dev->flags & IFF_LOOPBACK) { | 1072 | if (dev->flags & IFF_LOOPBACK) { |
1064 | struct in_ifaddr *ifa; | 1073 | struct in_ifaddr *ifa; |
@@ -1080,9 +1089,9 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
1080 | ip_mc_down(in_dev); | 1089 | ip_mc_down(in_dev); |
1081 | break; | 1090 | break; |
1082 | case NETDEV_CHANGEMTU: | 1091 | case NETDEV_CHANGEMTU: |
1083 | if (dev->mtu >= 68) | 1092 | if (inetdev_valid_mtu(dev->mtu)) |
1084 | break; | 1093 | break; |
1085 | /* MTU falled under 68, disable IP */ | 1094 | /* disable IP when MTU is not enough */ |
1086 | case NETDEV_UNREGISTER: | 1095 | case NETDEV_UNREGISTER: |
1087 | inetdev_destroy(in_dev); | 1096 | inetdev_destroy(in_dev); |
1088 | break; | 1097 | break; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index cca921ea8550..6ee5354c9aa1 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -3116,14 +3116,23 @@ static ctl_table ipv4_route_table[] = { | |||
3116 | { .ctl_name = 0 } | 3116 | { .ctl_name = 0 } |
3117 | }; | 3117 | }; |
3118 | 3118 | ||
3119 | static __net_initdata struct ctl_path ipv4_route_path[] = { | 3119 | static struct ctl_table empty[1]; |
3120 | |||
3121 | static struct ctl_table ipv4_skeleton[] = | ||
3122 | { | ||
3123 | { .procname = "route", .ctl_name = NET_IPV4_ROUTE, | ||
3124 | .mode = 0555, .child = ipv4_route_table}, | ||
3125 | { .procname = "neigh", .ctl_name = NET_IPV4_NEIGH, | ||
3126 | .mode = 0555, .child = empty}, | ||
3127 | { } | ||
3128 | }; | ||
3129 | |||
3130 | static __net_initdata struct ctl_path ipv4_path[] = { | ||
3120 | { .procname = "net", .ctl_name = CTL_NET, }, | 3131 | { .procname = "net", .ctl_name = CTL_NET, }, |
3121 | { .procname = "ipv4", .ctl_name = NET_IPV4, }, | 3132 | { .procname = "ipv4", .ctl_name = NET_IPV4, }, |
3122 | { .procname = "route", .ctl_name = NET_IPV4_ROUTE, }, | ||
3123 | { }, | 3133 | { }, |
3124 | }; | 3134 | }; |
3125 | 3135 | ||
3126 | |||
3127 | static struct ctl_table ipv4_route_flush_table[] = { | 3136 | static struct ctl_table ipv4_route_flush_table[] = { |
3128 | { | 3137 | { |
3129 | .ctl_name = NET_IPV4_ROUTE_FLUSH, | 3138 | .ctl_name = NET_IPV4_ROUTE_FLUSH, |
@@ -3136,6 +3145,13 @@ static struct ctl_table ipv4_route_flush_table[] = { | |||
3136 | { .ctl_name = 0 }, | 3145 | { .ctl_name = 0 }, |
3137 | }; | 3146 | }; |
3138 | 3147 | ||
3148 | static __net_initdata struct ctl_path ipv4_route_path[] = { | ||
3149 | { .procname = "net", .ctl_name = CTL_NET, }, | ||
3150 | { .procname = "ipv4", .ctl_name = NET_IPV4, }, | ||
3151 | { .procname = "route", .ctl_name = NET_IPV4_ROUTE, }, | ||
3152 | { }, | ||
3153 | }; | ||
3154 | |||
3139 | static __net_init int sysctl_route_net_init(struct net *net) | 3155 | static __net_init int sysctl_route_net_init(struct net *net) |
3140 | { | 3156 | { |
3141 | struct ctl_table *tbl; | 3157 | struct ctl_table *tbl; |
@@ -3287,7 +3303,7 @@ int __init ip_rt_init(void) | |||
3287 | */ | 3303 | */ |
3288 | void __init ip_static_sysctl_init(void) | 3304 | void __init ip_static_sysctl_init(void) |
3289 | { | 3305 | { |
3290 | register_sysctl_paths(ipv4_route_path, ipv4_route_table); | 3306 | register_sysctl_paths(ipv4_path, ipv4_skeleton); |
3291 | } | 3307 | } |
3292 | #endif | 3308 | #endif |
3293 | 3309 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index a00532de2a8c..8165f5aa8c71 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -468,7 +468,8 @@ static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb, | |||
468 | } | 468 | } |
469 | if (likely(sysctl_tcp_window_scaling)) { | 469 | if (likely(sysctl_tcp_window_scaling)) { |
470 | opts->ws = tp->rx_opt.rcv_wscale; | 470 | opts->ws = tp->rx_opt.rcv_wscale; |
471 | size += TCPOLEN_WSCALE_ALIGNED; | 471 | if(likely(opts->ws)) |
472 | size += TCPOLEN_WSCALE_ALIGNED; | ||
472 | } | 473 | } |
473 | if (likely(sysctl_tcp_sack)) { | 474 | if (likely(sysctl_tcp_sack)) { |
474 | opts->options |= OPTION_SACK_ADVERTISE; | 475 | opts->options |= OPTION_SACK_ADVERTISE; |
@@ -509,7 +510,8 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
509 | 510 | ||
510 | if (likely(ireq->wscale_ok)) { | 511 | if (likely(ireq->wscale_ok)) { |
511 | opts->ws = ireq->rcv_wscale; | 512 | opts->ws = ireq->rcv_wscale; |
512 | size += TCPOLEN_WSCALE_ALIGNED; | 513 | if(likely(opts->ws)) |
514 | size += TCPOLEN_WSCALE_ALIGNED; | ||
513 | } | 515 | } |
514 | if (likely(doing_ts)) { | 516 | if (likely(doing_ts)) { |
515 | opts->options |= OPTION_TS; | 517 | opts->options |= OPTION_TS; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 01d47674f7e5..e53e493606c5 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -377,14 +377,14 @@ static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb) | |||
377 | skb_checksum_complete(skb)) { | 377 | skb_checksum_complete(skb)) { |
378 | atomic_inc(&sk->sk_drops); | 378 | atomic_inc(&sk->sk_drops); |
379 | kfree_skb(skb); | 379 | kfree_skb(skb); |
380 | return 0; | 380 | return NET_RX_DROP; |
381 | } | 381 | } |
382 | 382 | ||
383 | /* Charge it to the socket. */ | 383 | /* Charge it to the socket. */ |
384 | if (sock_queue_rcv_skb(sk,skb)<0) { | 384 | if (sock_queue_rcv_skb(sk,skb)<0) { |
385 | atomic_inc(&sk->sk_drops); | 385 | atomic_inc(&sk->sk_drops); |
386 | kfree_skb(skb); | 386 | kfree_skb(skb); |
387 | return 0; | 387 | return NET_RX_DROP; |
388 | } | 388 | } |
389 | 389 | ||
390 | return 0; | 390 | return 0; |
@@ -429,7 +429,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) | |||
429 | if (skb_checksum_complete(skb)) { | 429 | if (skb_checksum_complete(skb)) { |
430 | atomic_inc(&sk->sk_drops); | 430 | atomic_inc(&sk->sk_drops); |
431 | kfree_skb(skb); | 431 | kfree_skb(skb); |
432 | return 0; | 432 | return NET_RX_DROP; |
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c index e6dfaeac6be3..587f8f60c489 100644 --- a/net/ipv6/sysctl_net_ipv6.c +++ b/net/ipv6/sysctl_net_ipv6.c | |||
@@ -156,7 +156,7 @@ static struct ctl_table_header *ip6_base; | |||
156 | int ipv6_static_sysctl_register(void) | 156 | int ipv6_static_sysctl_register(void) |
157 | { | 157 | { |
158 | static struct ctl_table empty[1]; | 158 | static struct ctl_table empty[1]; |
159 | ip6_base = register_net_sysctl_rotable(net_ipv6_ctl_path, empty); | 159 | ip6_base = register_sysctl_paths(net_ipv6_ctl_path, empty); |
160 | if (ip6_base == NULL) | 160 | if (ip6_base == NULL) |
161 | return -ENOMEM; | 161 | return -ENOMEM; |
162 | return 0; | 162 | return 0; |
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index 7439b63df5d0..cf82acec913a 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -265,7 +265,7 @@ void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) | |||
265 | key = sdata->default_key; | 265 | key = sdata->default_key; |
266 | if (key) { | 266 | if (key) { |
267 | sprintf(buf, "../keys/%d", key->debugfs.cnt); | 267 | sprintf(buf, "../keys/%d", key->debugfs.cnt); |
268 | sdata->debugfs.default_key = | 268 | sdata->common_debugfs.default_key = |
269 | debugfs_create_symlink("default_key", | 269 | debugfs_create_symlink("default_key", |
270 | sdata->debugfsdir, buf); | 270 | sdata->debugfsdir, buf); |
271 | } else | 271 | } else |
@@ -277,8 +277,8 @@ void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata) | |||
277 | if (!sdata) | 277 | if (!sdata) |
278 | return; | 278 | return; |
279 | 279 | ||
280 | debugfs_remove(sdata->debugfs.default_key); | 280 | debugfs_remove(sdata->common_debugfs.default_key); |
281 | sdata->debugfs.default_key = NULL; | 281 | sdata->common_debugfs.default_key = NULL; |
282 | } | 282 | } |
283 | 283 | ||
284 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, | 284 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, |
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 475f89a8aee1..8165df578c92 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -248,8 +248,8 @@ IEEE80211_IF_WFILE(min_discovery_timeout, | |||
248 | static void add_sta_files(struct ieee80211_sub_if_data *sdata) | 248 | static void add_sta_files(struct ieee80211_sub_if_data *sdata) |
249 | { | 249 | { |
250 | DEBUGFS_ADD(drop_unencrypted, sta); | 250 | DEBUGFS_ADD(drop_unencrypted, sta); |
251 | DEBUGFS_ADD(force_unicast_rateidx, ap); | 251 | DEBUGFS_ADD(force_unicast_rateidx, sta); |
252 | DEBUGFS_ADD(max_ratectrl_rateidx, ap); | 252 | DEBUGFS_ADD(max_ratectrl_rateidx, sta); |
253 | 253 | ||
254 | DEBUGFS_ADD(state, sta); | 254 | DEBUGFS_ADD(state, sta); |
255 | DEBUGFS_ADD(bssid, sta); | 255 | DEBUGFS_ADD(bssid, sta); |
@@ -283,8 +283,8 @@ static void add_ap_files(struct ieee80211_sub_if_data *sdata) | |||
283 | static void add_wds_files(struct ieee80211_sub_if_data *sdata) | 283 | static void add_wds_files(struct ieee80211_sub_if_data *sdata) |
284 | { | 284 | { |
285 | DEBUGFS_ADD(drop_unencrypted, wds); | 285 | DEBUGFS_ADD(drop_unencrypted, wds); |
286 | DEBUGFS_ADD(force_unicast_rateidx, ap); | 286 | DEBUGFS_ADD(force_unicast_rateidx, wds); |
287 | DEBUGFS_ADD(max_ratectrl_rateidx, ap); | 287 | DEBUGFS_ADD(max_ratectrl_rateidx, wds); |
288 | 288 | ||
289 | DEBUGFS_ADD(peer, wds); | 289 | DEBUGFS_ADD(peer, wds); |
290 | } | 290 | } |
@@ -292,8 +292,8 @@ static void add_wds_files(struct ieee80211_sub_if_data *sdata) | |||
292 | static void add_vlan_files(struct ieee80211_sub_if_data *sdata) | 292 | static void add_vlan_files(struct ieee80211_sub_if_data *sdata) |
293 | { | 293 | { |
294 | DEBUGFS_ADD(drop_unencrypted, vlan); | 294 | DEBUGFS_ADD(drop_unencrypted, vlan); |
295 | DEBUGFS_ADD(force_unicast_rateidx, ap); | 295 | DEBUGFS_ADD(force_unicast_rateidx, vlan); |
296 | DEBUGFS_ADD(max_ratectrl_rateidx, ap); | 296 | DEBUGFS_ADD(max_ratectrl_rateidx, vlan); |
297 | } | 297 | } |
298 | 298 | ||
299 | static void add_monitor_files(struct ieee80211_sub_if_data *sdata) | 299 | static void add_monitor_files(struct ieee80211_sub_if_data *sdata) |
@@ -381,8 +381,8 @@ static void add_files(struct ieee80211_sub_if_data *sdata) | |||
381 | static void del_sta_files(struct ieee80211_sub_if_data *sdata) | 381 | static void del_sta_files(struct ieee80211_sub_if_data *sdata) |
382 | { | 382 | { |
383 | DEBUGFS_DEL(drop_unencrypted, sta); | 383 | DEBUGFS_DEL(drop_unencrypted, sta); |
384 | DEBUGFS_DEL(force_unicast_rateidx, ap); | 384 | DEBUGFS_DEL(force_unicast_rateidx, sta); |
385 | DEBUGFS_DEL(max_ratectrl_rateidx, ap); | 385 | DEBUGFS_DEL(max_ratectrl_rateidx, sta); |
386 | 386 | ||
387 | DEBUGFS_DEL(state, sta); | 387 | DEBUGFS_DEL(state, sta); |
388 | DEBUGFS_DEL(bssid, sta); | 388 | DEBUGFS_DEL(bssid, sta); |
@@ -416,8 +416,8 @@ static void del_ap_files(struct ieee80211_sub_if_data *sdata) | |||
416 | static void del_wds_files(struct ieee80211_sub_if_data *sdata) | 416 | static void del_wds_files(struct ieee80211_sub_if_data *sdata) |
417 | { | 417 | { |
418 | DEBUGFS_DEL(drop_unencrypted, wds); | 418 | DEBUGFS_DEL(drop_unencrypted, wds); |
419 | DEBUGFS_DEL(force_unicast_rateidx, ap); | 419 | DEBUGFS_DEL(force_unicast_rateidx, wds); |
420 | DEBUGFS_DEL(max_ratectrl_rateidx, ap); | 420 | DEBUGFS_DEL(max_ratectrl_rateidx, wds); |
421 | 421 | ||
422 | DEBUGFS_DEL(peer, wds); | 422 | DEBUGFS_DEL(peer, wds); |
423 | } | 423 | } |
@@ -425,8 +425,8 @@ static void del_wds_files(struct ieee80211_sub_if_data *sdata) | |||
425 | static void del_vlan_files(struct ieee80211_sub_if_data *sdata) | 425 | static void del_vlan_files(struct ieee80211_sub_if_data *sdata) |
426 | { | 426 | { |
427 | DEBUGFS_DEL(drop_unencrypted, vlan); | 427 | DEBUGFS_DEL(drop_unencrypted, vlan); |
428 | DEBUGFS_DEL(force_unicast_rateidx, ap); | 428 | DEBUGFS_DEL(force_unicast_rateidx, vlan); |
429 | DEBUGFS_DEL(max_ratectrl_rateidx, ap); | 429 | DEBUGFS_DEL(max_ratectrl_rateidx, vlan); |
430 | } | 430 | } |
431 | 431 | ||
432 | static void del_monitor_files(struct ieee80211_sub_if_data *sdata) | 432 | static void del_monitor_files(struct ieee80211_sub_if_data *sdata) |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index ec59345af65b..4498d8713652 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -470,6 +470,8 @@ struct ieee80211_sub_if_data { | |||
470 | struct dentry *auth_transaction; | 470 | struct dentry *auth_transaction; |
471 | struct dentry *flags; | 471 | struct dentry *flags; |
472 | struct dentry *num_beacons_sta; | 472 | struct dentry *num_beacons_sta; |
473 | struct dentry *force_unicast_rateidx; | ||
474 | struct dentry *max_ratectrl_rateidx; | ||
473 | } sta; | 475 | } sta; |
474 | struct { | 476 | struct { |
475 | struct dentry *drop_unencrypted; | 477 | struct dentry *drop_unencrypted; |
@@ -483,15 +485,21 @@ struct ieee80211_sub_if_data { | |||
483 | struct { | 485 | struct { |
484 | struct dentry *drop_unencrypted; | 486 | struct dentry *drop_unencrypted; |
485 | struct dentry *peer; | 487 | struct dentry *peer; |
488 | struct dentry *force_unicast_rateidx; | ||
489 | struct dentry *max_ratectrl_rateidx; | ||
486 | } wds; | 490 | } wds; |
487 | struct { | 491 | struct { |
488 | struct dentry *drop_unencrypted; | 492 | struct dentry *drop_unencrypted; |
493 | struct dentry *force_unicast_rateidx; | ||
494 | struct dentry *max_ratectrl_rateidx; | ||
489 | } vlan; | 495 | } vlan; |
490 | struct { | 496 | struct { |
491 | struct dentry *mode; | 497 | struct dentry *mode; |
492 | } monitor; | 498 | } monitor; |
493 | struct dentry *default_key; | ||
494 | } debugfs; | 499 | } debugfs; |
500 | struct { | ||
501 | struct dentry *default_key; | ||
502 | } common_debugfs; | ||
495 | 503 | ||
496 | #ifdef CONFIG_MAC80211_MESH | 504 | #ifdef CONFIG_MAC80211_MESH |
497 | struct dentry *mesh_stats_dir; | 505 | struct dentry *mesh_stats_dir; |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index b5933b271491..35f2f95f2fa7 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -383,7 +383,7 @@ errcopy: | |||
383 | hlist_for_each_safe(p, q, &newtbl->hash_buckets[i]) | 383 | hlist_for_each_safe(p, q, &newtbl->hash_buckets[i]) |
384 | tbl->free_node(p, 0); | 384 | tbl->free_node(p, 0); |
385 | } | 385 | } |
386 | __mesh_table_free(tbl); | 386 | __mesh_table_free(newtbl); |
387 | endgrow: | 387 | endgrow: |
388 | return NULL; | 388 | return NULL; |
389 | } | 389 | } |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 1e97fb9fb34b..902cac1bd246 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -813,7 +813,7 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
813 | } | 813 | } |
814 | } | 814 | } |
815 | 815 | ||
816 | if (count == 8) { | 816 | if (rates_len > count) { |
817 | pos = skb_put(skb, rates_len - count + 2); | 817 | pos = skb_put(skb, rates_len - count + 2); |
818 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | 818 | *pos++ = WLAN_EID_EXT_SUPP_RATES; |
819 | *pos++ = rates_len - count; | 819 | *pos++ = rates_len - count; |
@@ -2868,7 +2868,7 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2868 | jiffies); | 2868 | jiffies); |
2869 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 2869 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
2870 | if (beacon_timestamp > rx_timestamp) { | 2870 | if (beacon_timestamp > rx_timestamp) { |
2871 | #ifndef CONFIG_MAC80211_IBSS_DEBUG | 2871 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
2872 | printk(KERN_DEBUG "%s: beacon TSF higher than " | 2872 | printk(KERN_DEBUG "%s: beacon TSF higher than " |
2873 | "local TSF - IBSS merge with BSSID %s\n", | 2873 | "local TSF - IBSS merge with BSSID %s\n", |
2874 | dev->name, print_mac(mac, mgmt->bssid)); | 2874 | dev->name, print_mac(mac, mgmt->bssid)); |
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index 35a9994e2339..74aecc098bad 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c | |||
@@ -377,7 +377,7 @@ static ssize_t rfkill_claim_show(struct device *dev, | |||
377 | { | 377 | { |
378 | struct rfkill *rfkill = to_rfkill(dev); | 378 | struct rfkill *rfkill = to_rfkill(dev); |
379 | 379 | ||
380 | return sprintf(buf, "%d", rfkill->user_claim); | 380 | return sprintf(buf, "%d\n", rfkill->user_claim); |
381 | } | 381 | } |
382 | 382 | ||
383 | static ssize_t rfkill_claim_store(struct device *dev, | 383 | static ssize_t rfkill_claim_store(struct device *dev, |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 5cafdd4c8018..8eb79e92e94c 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -205,7 +205,7 @@ replay: | |||
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | root_lock = qdisc_root_lock(q); | 208 | root_lock = qdisc_root_sleeping_lock(q); |
209 | 209 | ||
210 | if (tp == NULL) { | 210 | if (tp == NULL) { |
211 | /* Proto-tcf does not exist, create new one */ | 211 | /* Proto-tcf does not exist, create new one */ |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 481260a4f10f..e3d8455eebc2 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -75,7 +75,7 @@ static __inline__ int route4_fastmap_hash(u32 id, int iif) | |||
75 | static inline | 75 | static inline |
76 | void route4_reset_fastmap(struct Qdisc *q, struct route4_head *head, u32 id) | 76 | void route4_reset_fastmap(struct Qdisc *q, struct route4_head *head, u32 id) |
77 | { | 77 | { |
78 | spinlock_t *root_lock = qdisc_root_lock(q); | 78 | spinlock_t *root_lock = qdisc_root_sleeping_lock(q); |
79 | 79 | ||
80 | spin_lock_bh(root_lock); | 80 | spin_lock_bh(root_lock); |
81 | memset(head->fastmap, 0, sizeof(head->fastmap)); | 81 | memset(head->fastmap, 0, sizeof(head->fastmap)); |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index e7fb9e0d21b4..1122c952aa99 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -624,7 +624,7 @@ static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, | |||
624 | struct Qdisc *oqdisc = dev_queue->qdisc_sleeping; | 624 | struct Qdisc *oqdisc = dev_queue->qdisc_sleeping; |
625 | spinlock_t *root_lock; | 625 | spinlock_t *root_lock; |
626 | 626 | ||
627 | root_lock = qdisc_root_lock(oqdisc); | 627 | root_lock = qdisc_lock(oqdisc); |
628 | spin_lock_bh(root_lock); | 628 | spin_lock_bh(root_lock); |
629 | 629 | ||
630 | /* Prune old scheduler */ | 630 | /* Prune old scheduler */ |
@@ -635,7 +635,7 @@ static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, | |||
635 | if (qdisc == NULL) | 635 | if (qdisc == NULL) |
636 | qdisc = &noop_qdisc; | 636 | qdisc = &noop_qdisc; |
637 | dev_queue->qdisc_sleeping = qdisc; | 637 | dev_queue->qdisc_sleeping = qdisc; |
638 | dev_queue->qdisc = &noop_qdisc; | 638 | rcu_assign_pointer(dev_queue->qdisc, &noop_qdisc); |
639 | 639 | ||
640 | spin_unlock_bh(root_lock); | 640 | spin_unlock_bh(root_lock); |
641 | 641 | ||
@@ -830,9 +830,16 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, | |||
830 | sch->stab = stab; | 830 | sch->stab = stab; |
831 | } | 831 | } |
832 | if (tca[TCA_RATE]) { | 832 | if (tca[TCA_RATE]) { |
833 | spinlock_t *root_lock; | ||
834 | |||
835 | if ((sch->parent != TC_H_ROOT) && | ||
836 | !(sch->flags & TCQ_F_INGRESS)) | ||
837 | root_lock = qdisc_root_sleeping_lock(sch); | ||
838 | else | ||
839 | root_lock = qdisc_lock(sch); | ||
840 | |||
833 | err = gen_new_estimator(&sch->bstats, &sch->rate_est, | 841 | err = gen_new_estimator(&sch->bstats, &sch->rate_est, |
834 | qdisc_root_lock(sch), | 842 | root_lock, tca[TCA_RATE]); |
835 | tca[TCA_RATE]); | ||
836 | if (err) { | 843 | if (err) { |
837 | /* | 844 | /* |
838 | * Any broken qdiscs that would require | 845 | * Any broken qdiscs that would require |
@@ -884,7 +891,8 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca) | |||
884 | 891 | ||
885 | if (tca[TCA_RATE]) | 892 | if (tca[TCA_RATE]) |
886 | gen_replace_estimator(&sch->bstats, &sch->rate_est, | 893 | gen_replace_estimator(&sch->bstats, &sch->rate_est, |
887 | qdisc_root_lock(sch), tca[TCA_RATE]); | 894 | qdisc_root_sleeping_lock(sch), |
895 | tca[TCA_RATE]); | ||
888 | return 0; | 896 | return 0; |
889 | } | 897 | } |
890 | 898 | ||
@@ -1161,8 +1169,8 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | |||
1161 | if (q->stab && qdisc_dump_stab(skb, q->stab) < 0) | 1169 | if (q->stab && qdisc_dump_stab(skb, q->stab) < 0) |
1162 | goto nla_put_failure; | 1170 | goto nla_put_failure; |
1163 | 1171 | ||
1164 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, | 1172 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, TCA_XSTATS, |
1165 | TCA_XSTATS, qdisc_root_lock(q), &d) < 0) | 1173 | qdisc_root_sleeping_lock(q), &d) < 0) |
1166 | goto nla_put_failure; | 1174 | goto nla_put_failure; |
1167 | 1175 | ||
1168 | if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0) | 1176 | if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0) |
@@ -1453,8 +1461,8 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | |||
1453 | if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) | 1461 | if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) |
1454 | goto nla_put_failure; | 1462 | goto nla_put_failure; |
1455 | 1463 | ||
1456 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, | 1464 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, TCA_XSTATS, |
1457 | TCA_XSTATS, qdisc_root_lock(q), &d) < 0) | 1465 | qdisc_root_sleeping_lock(q), &d) < 0) |
1458 | goto nla_put_failure; | 1466 | goto nla_put_failure; |
1459 | 1467 | ||
1460 | if (cl_ops->dump_stats && cl_ops->dump_stats(q, cl, &d) < 0) | 1468 | if (cl_ops->dump_stats && cl_ops->dump_stats(q, cl, &d) < 0) |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 8fa90d68ec6d..8b06fa900482 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1754,7 +1754,7 @@ static void cbq_put(struct Qdisc *sch, unsigned long arg) | |||
1754 | 1754 | ||
1755 | if (--cl->refcnt == 0) { | 1755 | if (--cl->refcnt == 0) { |
1756 | #ifdef CONFIG_NET_CLS_ACT | 1756 | #ifdef CONFIG_NET_CLS_ACT |
1757 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1757 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
1758 | struct cbq_sched_data *q = qdisc_priv(sch); | 1758 | struct cbq_sched_data *q = qdisc_priv(sch); |
1759 | 1759 | ||
1760 | spin_lock_bh(root_lock); | 1760 | spin_lock_bh(root_lock); |
@@ -1839,7 +1839,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t | |||
1839 | 1839 | ||
1840 | if (tca[TCA_RATE]) | 1840 | if (tca[TCA_RATE]) |
1841 | gen_replace_estimator(&cl->bstats, &cl->rate_est, | 1841 | gen_replace_estimator(&cl->bstats, &cl->rate_est, |
1842 | qdisc_root_lock(sch), | 1842 | qdisc_root_sleeping_lock(sch), |
1843 | tca[TCA_RATE]); | 1843 | tca[TCA_RATE]); |
1844 | return 0; | 1844 | return 0; |
1845 | } | 1845 | } |
@@ -1930,7 +1930,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t | |||
1930 | 1930 | ||
1931 | if (tca[TCA_RATE]) | 1931 | if (tca[TCA_RATE]) |
1932 | gen_new_estimator(&cl->bstats, &cl->rate_est, | 1932 | gen_new_estimator(&cl->bstats, &cl->rate_est, |
1933 | qdisc_root_lock(sch), tca[TCA_RATE]); | 1933 | qdisc_root_sleeping_lock(sch), tca[TCA_RATE]); |
1934 | 1934 | ||
1935 | *arg = (unsigned long)cl; | 1935 | *arg = (unsigned long)cl; |
1936 | return 0; | 1936 | return 0; |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 5f0ade7806a7..9634091ee2f0 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -634,7 +634,7 @@ static void dev_deactivate_queue(struct net_device *dev, | |||
634 | if (!(qdisc->flags & TCQ_F_BUILTIN)) | 634 | if (!(qdisc->flags & TCQ_F_BUILTIN)) |
635 | set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state); | 635 | set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state); |
636 | 636 | ||
637 | dev_queue->qdisc = qdisc_default; | 637 | rcu_assign_pointer(dev_queue->qdisc, qdisc_default); |
638 | qdisc_reset(qdisc); | 638 | qdisc_reset(qdisc); |
639 | 639 | ||
640 | spin_unlock_bh(qdisc_lock(qdisc)); | 640 | spin_unlock_bh(qdisc_lock(qdisc)); |
@@ -709,7 +709,7 @@ static void shutdown_scheduler_queue(struct net_device *dev, | |||
709 | struct Qdisc *qdisc_default = _qdisc_default; | 709 | struct Qdisc *qdisc_default = _qdisc_default; |
710 | 710 | ||
711 | if (qdisc) { | 711 | if (qdisc) { |
712 | dev_queue->qdisc = qdisc_default; | 712 | rcu_assign_pointer(dev_queue->qdisc, qdisc_default); |
713 | dev_queue->qdisc_sleeping = qdisc_default; | 713 | dev_queue->qdisc_sleeping = qdisc_default; |
714 | 714 | ||
715 | qdisc_destroy(qdisc); | 715 | qdisc_destroy(qdisc); |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index c2b8d9cce3d2..c1e77da8cd09 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -1045,7 +1045,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
1045 | 1045 | ||
1046 | if (tca[TCA_RATE]) | 1046 | if (tca[TCA_RATE]) |
1047 | gen_replace_estimator(&cl->bstats, &cl->rate_est, | 1047 | gen_replace_estimator(&cl->bstats, &cl->rate_est, |
1048 | qdisc_root_lock(sch), | 1048 | qdisc_root_sleeping_lock(sch), |
1049 | tca[TCA_RATE]); | 1049 | tca[TCA_RATE]); |
1050 | return 0; | 1050 | return 0; |
1051 | } | 1051 | } |
@@ -1104,7 +1104,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
1104 | 1104 | ||
1105 | if (tca[TCA_RATE]) | 1105 | if (tca[TCA_RATE]) |
1106 | gen_new_estimator(&cl->bstats, &cl->rate_est, | 1106 | gen_new_estimator(&cl->bstats, &cl->rate_est, |
1107 | qdisc_root_lock(sch), tca[TCA_RATE]); | 1107 | qdisc_root_sleeping_lock(sch), tca[TCA_RATE]); |
1108 | *arg = (unsigned long)cl; | 1108 | *arg = (unsigned long)cl; |
1109 | return 0; | 1109 | return 0; |
1110 | } | 1110 | } |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 0df0df202ed0..d14f02056ae6 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1043,7 +1043,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt) | |||
1043 | 1043 | ||
1044 | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) | 1044 | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) |
1045 | { | 1045 | { |
1046 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1046 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
1047 | struct htb_sched *q = qdisc_priv(sch); | 1047 | struct htb_sched *q = qdisc_priv(sch); |
1048 | struct nlattr *nest; | 1048 | struct nlattr *nest; |
1049 | struct tc_htb_glob gopt; | 1049 | struct tc_htb_glob gopt; |
@@ -1075,7 +1075,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, | |||
1075 | struct sk_buff *skb, struct tcmsg *tcm) | 1075 | struct sk_buff *skb, struct tcmsg *tcm) |
1076 | { | 1076 | { |
1077 | struct htb_class *cl = (struct htb_class *)arg; | 1077 | struct htb_class *cl = (struct htb_class *)arg; |
1078 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1078 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
1079 | struct nlattr *nest; | 1079 | struct nlattr *nest; |
1080 | struct tc_htb_opt opt; | 1080 | struct tc_htb_opt opt; |
1081 | 1081 | ||
@@ -1372,7 +1372,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1372 | goto failure; | 1372 | goto failure; |
1373 | 1373 | ||
1374 | gen_new_estimator(&cl->bstats, &cl->rate_est, | 1374 | gen_new_estimator(&cl->bstats, &cl->rate_est, |
1375 | qdisc_root_lock(sch), | 1375 | qdisc_root_sleeping_lock(sch), |
1376 | tca[TCA_RATE] ? : &est.nla); | 1376 | tca[TCA_RATE] ? : &est.nla); |
1377 | cl->refcnt = 1; | 1377 | cl->refcnt = 1; |
1378 | cl->children = 0; | 1378 | cl->children = 0; |
@@ -1427,7 +1427,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1427 | } else { | 1427 | } else { |
1428 | if (tca[TCA_RATE]) | 1428 | if (tca[TCA_RATE]) |
1429 | gen_replace_estimator(&cl->bstats, &cl->rate_est, | 1429 | gen_replace_estimator(&cl->bstats, &cl->rate_est, |
1430 | qdisc_root_lock(sch), | 1430 | qdisc_root_sleeping_lock(sch), |
1431 | tca[TCA_RATE]); | 1431 | tca[TCA_RATE]); |
1432 | sch_tree_lock(sch); | 1432 | sch_tree_lock(sch); |
1433 | } | 1433 | } |
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index fb0294d0b55e..3781e55046d0 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -341,7 +341,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | |||
341 | for (i = 0; i < n; i++) | 341 | for (i = 0; i < n; i++) |
342 | d->table[i] = data[i]; | 342 | d->table[i] = data[i]; |
343 | 343 | ||
344 | root_lock = qdisc_root_lock(sch); | 344 | root_lock = qdisc_root_sleeping_lock(sch); |
345 | 345 | ||
346 | spin_lock_bh(root_lock); | 346 | spin_lock_bh(root_lock); |
347 | d = xchg(&q->delay_dist, d); | 347 | d = xchg(&q->delay_dist, d); |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 2c35c678563b..d35ef059abb1 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
@@ -161,7 +161,7 @@ teql_destroy(struct Qdisc* sch) | |||
161 | txq = netdev_get_tx_queue(master->dev, 0); | 161 | txq = netdev_get_tx_queue(master->dev, 0); |
162 | master->slaves = NULL; | 162 | master->slaves = NULL; |
163 | 163 | ||
164 | root_lock = qdisc_root_lock(txq->qdisc); | 164 | root_lock = qdisc_root_sleeping_lock(txq->qdisc); |
165 | spin_lock_bh(root_lock); | 165 | spin_lock_bh(root_lock); |
166 | qdisc_reset(txq->qdisc); | 166 | qdisc_reset(txq->qdisc); |
167 | spin_unlock_bh(root_lock); | 167 | spin_unlock_bh(root_lock); |
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 675a5c3e68a6..52db5f60daa0 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c | |||
@@ -80,6 +80,10 @@ static struct sctp_auth_bytes *sctp_auth_create_key(__u32 key_len, gfp_t gfp) | |||
80 | { | 80 | { |
81 | struct sctp_auth_bytes *key; | 81 | struct sctp_auth_bytes *key; |
82 | 82 | ||
83 | /* Verify that we are not going to overflow INT_MAX */ | ||
84 | if ((INT_MAX - key_len) < sizeof(struct sctp_auth_bytes)) | ||
85 | return NULL; | ||
86 | |||
83 | /* Allocate the shared key */ | 87 | /* Allocate the shared key */ |
84 | key = kmalloc(sizeof(struct sctp_auth_bytes) + key_len, gfp); | 88 | key = kmalloc(sizeof(struct sctp_auth_bytes) + key_len, gfp); |
85 | if (!key) | 89 | if (!key) |
@@ -782,6 +786,9 @@ int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep, | |||
782 | for (i = 0; i < hmacs->shmac_num_idents; i++) { | 786 | for (i = 0; i < hmacs->shmac_num_idents; i++) { |
783 | id = hmacs->shmac_idents[i]; | 787 | id = hmacs->shmac_idents[i]; |
784 | 788 | ||
789 | if (id > SCTP_AUTH_HMAC_ID_MAX) | ||
790 | return -EOPNOTSUPP; | ||
791 | |||
785 | if (SCTP_AUTH_HMAC_ID_SHA1 == id) | 792 | if (SCTP_AUTH_HMAC_ID_SHA1 == id) |
786 | has_sha1 = 1; | 793 | has_sha1 = 1; |
787 | 794 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index bb5c9ef13046..5ffb9dec1c3f 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -3086,6 +3086,7 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk, | |||
3086 | int optlen) | 3086 | int optlen) |
3087 | { | 3087 | { |
3088 | struct sctp_hmacalgo *hmacs; | 3088 | struct sctp_hmacalgo *hmacs; |
3089 | u32 idents; | ||
3089 | int err; | 3090 | int err; |
3090 | 3091 | ||
3091 | if (!sctp_auth_enable) | 3092 | if (!sctp_auth_enable) |
@@ -3103,8 +3104,9 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk, | |||
3103 | goto out; | 3104 | goto out; |
3104 | } | 3105 | } |
3105 | 3106 | ||
3106 | if (hmacs->shmac_num_idents == 0 || | 3107 | idents = hmacs->shmac_num_idents; |
3107 | hmacs->shmac_num_idents > SCTP_AUTH_NUM_HMACS) { | 3108 | if (idents == 0 || idents > SCTP_AUTH_NUM_HMACS || |
3109 | (idents * sizeof(u16)) > (optlen - sizeof(struct sctp_hmacalgo))) { | ||
3108 | err = -EINVAL; | 3110 | err = -EINVAL; |
3109 | goto out; | 3111 | goto out; |
3110 | } | 3112 | } |
@@ -3144,6 +3146,11 @@ static int sctp_setsockopt_auth_key(struct sock *sk, | |||
3144 | goto out; | 3146 | goto out; |
3145 | } | 3147 | } |
3146 | 3148 | ||
3149 | if (authkey->sca_keylength > optlen - sizeof(struct sctp_authkey)) { | ||
3150 | ret = -EINVAL; | ||
3151 | goto out; | ||
3152 | } | ||
3153 | |||
3147 | asoc = sctp_id2assoc(sk, authkey->sca_assoc_id); | 3154 | asoc = sctp_id2assoc(sk, authkey->sca_assoc_id); |
3148 | if (!asoc && authkey->sca_assoc_id && sctp_style(sk, UDP)) { | 3155 | if (!asoc && authkey->sca_assoc_id && sctp_style(sk, UDP)) { |
3149 | ret = -EINVAL; | 3156 | ret = -EINVAL; |
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index 0f8c439b848a..5231f7aaac0e 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c | |||
@@ -60,24 +60,14 @@ static int proc_do_xprt(ctl_table *table, int write, struct file *file, | |||
60 | void __user *buffer, size_t *lenp, loff_t *ppos) | 60 | void __user *buffer, size_t *lenp, loff_t *ppos) |
61 | { | 61 | { |
62 | char tmpbuf[256]; | 62 | char tmpbuf[256]; |
63 | int len; | 63 | size_t len; |
64 | |||
64 | if ((*ppos && !write) || !*lenp) { | 65 | if ((*ppos && !write) || !*lenp) { |
65 | *lenp = 0; | 66 | *lenp = 0; |
66 | return 0; | 67 | return 0; |
67 | } | 68 | } |
68 | if (write) | 69 | len = svc_print_xprts(tmpbuf, sizeof(tmpbuf)); |
69 | return -EINVAL; | 70 | return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len); |
70 | else { | ||
71 | len = svc_print_xprts(tmpbuf, sizeof(tmpbuf)); | ||
72 | if (!access_ok(VERIFY_WRITE, buffer, len)) | ||
73 | return -EFAULT; | ||
74 | |||
75 | if (__copy_to_user(buffer, tmpbuf, len)) | ||
76 | return -EFAULT; | ||
77 | } | ||
78 | *lenp -= len; | ||
79 | *ppos += len; | ||
80 | return 0; | ||
81 | } | 71 | } |
82 | 72 | ||
83 | static int | 73 | static int |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index b4b17f44cb29..74de31a06616 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | |||
@@ -443,18 +443,18 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) | |||
443 | 443 | ||
444 | dprintk("svcrdma: rqstp=%p\n", rqstp); | 444 | dprintk("svcrdma: rqstp=%p\n", rqstp); |
445 | 445 | ||
446 | spin_lock_bh(&rdma_xprt->sc_read_complete_lock); | 446 | spin_lock_bh(&rdma_xprt->sc_rq_dto_lock); |
447 | if (!list_empty(&rdma_xprt->sc_read_complete_q)) { | 447 | if (!list_empty(&rdma_xprt->sc_read_complete_q)) { |
448 | ctxt = list_entry(rdma_xprt->sc_read_complete_q.next, | 448 | ctxt = list_entry(rdma_xprt->sc_read_complete_q.next, |
449 | struct svc_rdma_op_ctxt, | 449 | struct svc_rdma_op_ctxt, |
450 | dto_q); | 450 | dto_q); |
451 | list_del_init(&ctxt->dto_q); | 451 | list_del_init(&ctxt->dto_q); |
452 | } | 452 | } |
453 | spin_unlock_bh(&rdma_xprt->sc_read_complete_lock); | 453 | if (ctxt) { |
454 | if (ctxt) | 454 | spin_unlock_bh(&rdma_xprt->sc_rq_dto_lock); |
455 | return rdma_read_complete(rqstp, ctxt); | 455 | return rdma_read_complete(rqstp, ctxt); |
456 | } | ||
456 | 457 | ||
457 | spin_lock_bh(&rdma_xprt->sc_rq_dto_lock); | ||
458 | if (!list_empty(&rdma_xprt->sc_rq_dto_q)) { | 458 | if (!list_empty(&rdma_xprt->sc_rq_dto_q)) { |
459 | ctxt = list_entry(rdma_xprt->sc_rq_dto_q.next, | 459 | ctxt = list_entry(rdma_xprt->sc_rq_dto_q.next, |
460 | struct svc_rdma_op_ctxt, | 460 | struct svc_rdma_op_ctxt, |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index 19ddc382b777..900cb69728c6 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c | |||
@@ -359,11 +359,11 @@ static void sq_cq_reap(struct svcxprt_rdma *xprt) | |||
359 | if (test_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags)) { | 359 | if (test_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags)) { |
360 | struct svc_rdma_op_ctxt *read_hdr = ctxt->read_hdr; | 360 | struct svc_rdma_op_ctxt *read_hdr = ctxt->read_hdr; |
361 | BUG_ON(!read_hdr); | 361 | BUG_ON(!read_hdr); |
362 | spin_lock_bh(&xprt->sc_rq_dto_lock); | ||
362 | set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags); | 363 | set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags); |
363 | spin_lock_bh(&xprt->sc_read_complete_lock); | ||
364 | list_add_tail(&read_hdr->dto_q, | 364 | list_add_tail(&read_hdr->dto_q, |
365 | &xprt->sc_read_complete_q); | 365 | &xprt->sc_read_complete_q); |
366 | spin_unlock_bh(&xprt->sc_read_complete_lock); | 366 | spin_unlock_bh(&xprt->sc_rq_dto_lock); |
367 | svc_xprt_enqueue(&xprt->sc_xprt); | 367 | svc_xprt_enqueue(&xprt->sc_xprt); |
368 | } | 368 | } |
369 | svc_rdma_put_context(ctxt, 0); | 369 | svc_rdma_put_context(ctxt, 0); |
@@ -428,7 +428,6 @@ static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *serv, | |||
428 | init_waitqueue_head(&cma_xprt->sc_send_wait); | 428 | init_waitqueue_head(&cma_xprt->sc_send_wait); |
429 | 429 | ||
430 | spin_lock_init(&cma_xprt->sc_lock); | 430 | spin_lock_init(&cma_xprt->sc_lock); |
431 | spin_lock_init(&cma_xprt->sc_read_complete_lock); | ||
432 | spin_lock_init(&cma_xprt->sc_rq_dto_lock); | 431 | spin_lock_init(&cma_xprt->sc_rq_dto_lock); |
433 | 432 | ||
434 | cma_xprt->sc_ord = svcrdma_ord; | 433 | cma_xprt->sc_ord = svcrdma_ord; |
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index b1ff16aa4bdb..3ddaff42d1bb 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -96,8 +96,8 @@ struct bcbearer { | |||
96 | struct media media; | 96 | struct media media; |
97 | struct bcbearer_pair bpairs[MAX_BEARERS]; | 97 | struct bcbearer_pair bpairs[MAX_BEARERS]; |
98 | struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1]; | 98 | struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1]; |
99 | struct node_map remains; | 99 | struct tipc_node_map remains; |
100 | struct node_map remains_new; | 100 | struct tipc_node_map remains_new; |
101 | }; | 101 | }; |
102 | 102 | ||
103 | /** | 103 | /** |
@@ -110,7 +110,7 @@ struct bcbearer { | |||
110 | 110 | ||
111 | struct bclink { | 111 | struct bclink { |
112 | struct link link; | 112 | struct link link; |
113 | struct node node; | 113 | struct tipc_node node; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | 116 | ||
@@ -149,7 +149,7 @@ static void bcbuf_decr_acks(struct sk_buff *buf) | |||
149 | * Called with 'node' locked, bc_lock unlocked | 149 | * Called with 'node' locked, bc_lock unlocked |
150 | */ | 150 | */ |
151 | 151 | ||
152 | static void bclink_set_gap(struct node *n_ptr) | 152 | static void bclink_set_gap(struct tipc_node *n_ptr) |
153 | { | 153 | { |
154 | struct sk_buff *buf = n_ptr->bclink.deferred_head; | 154 | struct sk_buff *buf = n_ptr->bclink.deferred_head; |
155 | 155 | ||
@@ -202,7 +202,7 @@ static void bclink_retransmit_pkt(u32 after, u32 to) | |||
202 | * Node is locked, bc_lock unlocked. | 202 | * Node is locked, bc_lock unlocked. |
203 | */ | 203 | */ |
204 | 204 | ||
205 | void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked) | 205 | void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked) |
206 | { | 206 | { |
207 | struct sk_buff *crs; | 207 | struct sk_buff *crs; |
208 | struct sk_buff *next; | 208 | struct sk_buff *next; |
@@ -250,7 +250,7 @@ void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked) | |||
250 | * tipc_net_lock and node lock set | 250 | * tipc_net_lock and node lock set |
251 | */ | 251 | */ |
252 | 252 | ||
253 | static void bclink_send_ack(struct node *n_ptr) | 253 | static void bclink_send_ack(struct tipc_node *n_ptr) |
254 | { | 254 | { |
255 | struct link *l_ptr = n_ptr->active_links[n_ptr->addr & 1]; | 255 | struct link *l_ptr = n_ptr->active_links[n_ptr->addr & 1]; |
256 | 256 | ||
@@ -264,7 +264,7 @@ static void bclink_send_ack(struct node *n_ptr) | |||
264 | * tipc_net_lock and node lock set | 264 | * tipc_net_lock and node lock set |
265 | */ | 265 | */ |
266 | 266 | ||
267 | static void bclink_send_nack(struct node *n_ptr) | 267 | static void bclink_send_nack(struct tipc_node *n_ptr) |
268 | { | 268 | { |
269 | struct sk_buff *buf; | 269 | struct sk_buff *buf; |
270 | struct tipc_msg *msg; | 270 | struct tipc_msg *msg; |
@@ -308,7 +308,7 @@ static void bclink_send_nack(struct node *n_ptr) | |||
308 | * tipc_net_lock and node lock set | 308 | * tipc_net_lock and node lock set |
309 | */ | 309 | */ |
310 | 310 | ||
311 | void tipc_bclink_check_gap(struct node *n_ptr, u32 last_sent) | 311 | void tipc_bclink_check_gap(struct tipc_node *n_ptr, u32 last_sent) |
312 | { | 312 | { |
313 | if (!n_ptr->bclink.supported || | 313 | if (!n_ptr->bclink.supported || |
314 | less_eq(last_sent, mod(n_ptr->bclink.last_in))) | 314 | less_eq(last_sent, mod(n_ptr->bclink.last_in))) |
@@ -328,7 +328,7 @@ void tipc_bclink_check_gap(struct node *n_ptr, u32 last_sent) | |||
328 | 328 | ||
329 | static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to) | 329 | static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to) |
330 | { | 330 | { |
331 | struct node *n_ptr = tipc_node_find(dest); | 331 | struct tipc_node *n_ptr = tipc_node_find(dest); |
332 | u32 my_after, my_to; | 332 | u32 my_after, my_to; |
333 | 333 | ||
334 | if (unlikely(!n_ptr || !tipc_node_is_up(n_ptr))) | 334 | if (unlikely(!n_ptr || !tipc_node_is_up(n_ptr))) |
@@ -418,7 +418,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) | |||
418 | static int rx_count = 0; | 418 | static int rx_count = 0; |
419 | #endif | 419 | #endif |
420 | struct tipc_msg *msg = buf_msg(buf); | 420 | struct tipc_msg *msg = buf_msg(buf); |
421 | struct node* node = tipc_node_find(msg_prevnode(msg)); | 421 | struct tipc_node* node = tipc_node_find(msg_prevnode(msg)); |
422 | u32 next_in; | 422 | u32 next_in; |
423 | u32 seqno; | 423 | u32 seqno; |
424 | struct sk_buff *deferred; | 424 | struct sk_buff *deferred; |
@@ -538,7 +538,7 @@ u32 tipc_bclink_get_last_sent(void) | |||
538 | return last_sent; | 538 | return last_sent; |
539 | } | 539 | } |
540 | 540 | ||
541 | u32 tipc_bclink_acks_missing(struct node *n_ptr) | 541 | u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr) |
542 | { | 542 | { |
543 | return (n_ptr->bclink.supported && | 543 | return (n_ptr->bclink.supported && |
544 | (tipc_bclink_get_last_sent() != n_ptr->bclink.acked)); | 544 | (tipc_bclink_get_last_sent() != n_ptr->bclink.acked)); |
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h index a2416fa6b906..5aa024b99c55 100644 --- a/net/tipc/bcast.h +++ b/net/tipc/bcast.h | |||
@@ -41,12 +41,12 @@ | |||
41 | #define WSIZE 32 | 41 | #define WSIZE 32 |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * struct node_map - set of node identifiers | 44 | * struct tipc_node_map - set of node identifiers |
45 | * @count: # of nodes in set | 45 | * @count: # of nodes in set |
46 | * @map: bitmap of node identifiers that are in the set | 46 | * @map: bitmap of node identifiers that are in the set |
47 | */ | 47 | */ |
48 | 48 | ||
49 | struct node_map { | 49 | struct tipc_node_map { |
50 | u32 count; | 50 | u32 count; |
51 | u32 map[MAX_NODES / WSIZE]; | 51 | u32 map[MAX_NODES / WSIZE]; |
52 | }; | 52 | }; |
@@ -68,7 +68,7 @@ struct port_list { | |||
68 | }; | 68 | }; |
69 | 69 | ||
70 | 70 | ||
71 | struct node; | 71 | struct tipc_node; |
72 | 72 | ||
73 | extern char tipc_bclink_name[]; | 73 | extern char tipc_bclink_name[]; |
74 | 74 | ||
@@ -77,7 +77,7 @@ extern char tipc_bclink_name[]; | |||
77 | * nmap_add - add a node to a node map | 77 | * nmap_add - add a node to a node map |
78 | */ | 78 | */ |
79 | 79 | ||
80 | static inline void tipc_nmap_add(struct node_map *nm_ptr, u32 node) | 80 | static inline void tipc_nmap_add(struct tipc_node_map *nm_ptr, u32 node) |
81 | { | 81 | { |
82 | int n = tipc_node(node); | 82 | int n = tipc_node(node); |
83 | int w = n / WSIZE; | 83 | int w = n / WSIZE; |
@@ -93,7 +93,7 @@ static inline void tipc_nmap_add(struct node_map *nm_ptr, u32 node) | |||
93 | * nmap_remove - remove a node from a node map | 93 | * nmap_remove - remove a node from a node map |
94 | */ | 94 | */ |
95 | 95 | ||
96 | static inline void tipc_nmap_remove(struct node_map *nm_ptr, u32 node) | 96 | static inline void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node) |
97 | { | 97 | { |
98 | int n = tipc_node(node); | 98 | int n = tipc_node(node); |
99 | int w = n / WSIZE; | 99 | int w = n / WSIZE; |
@@ -109,7 +109,7 @@ static inline void tipc_nmap_remove(struct node_map *nm_ptr, u32 node) | |||
109 | * nmap_equal - test for equality of node maps | 109 | * nmap_equal - test for equality of node maps |
110 | */ | 110 | */ |
111 | 111 | ||
112 | static inline int tipc_nmap_equal(struct node_map *nm_a, struct node_map *nm_b) | 112 | static inline int tipc_nmap_equal(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b) |
113 | { | 113 | { |
114 | return !memcmp(nm_a, nm_b, sizeof(*nm_a)); | 114 | return !memcmp(nm_a, nm_b, sizeof(*nm_a)); |
115 | } | 115 | } |
@@ -121,8 +121,8 @@ static inline int tipc_nmap_equal(struct node_map *nm_a, struct node_map *nm_b) | |||
121 | * @nm_diff: output node map A-B (i.e. nodes of A that are not in B) | 121 | * @nm_diff: output node map A-B (i.e. nodes of A that are not in B) |
122 | */ | 122 | */ |
123 | 123 | ||
124 | static inline void tipc_nmap_diff(struct node_map *nm_a, struct node_map *nm_b, | 124 | static inline void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b, |
125 | struct node_map *nm_diff) | 125 | struct tipc_node_map *nm_diff) |
126 | { | 126 | { |
127 | int stop = sizeof(nm_a->map) / sizeof(u32); | 127 | int stop = sizeof(nm_a->map) / sizeof(u32); |
128 | int w; | 128 | int w; |
@@ -195,12 +195,12 @@ static inline void tipc_port_list_free(struct port_list *pl_ptr) | |||
195 | 195 | ||
196 | int tipc_bclink_init(void); | 196 | int tipc_bclink_init(void); |
197 | void tipc_bclink_stop(void); | 197 | void tipc_bclink_stop(void); |
198 | void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked); | 198 | void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked); |
199 | int tipc_bclink_send_msg(struct sk_buff *buf); | 199 | int tipc_bclink_send_msg(struct sk_buff *buf); |
200 | void tipc_bclink_recv_pkt(struct sk_buff *buf); | 200 | void tipc_bclink_recv_pkt(struct sk_buff *buf); |
201 | u32 tipc_bclink_get_last_sent(void); | 201 | u32 tipc_bclink_get_last_sent(void); |
202 | u32 tipc_bclink_acks_missing(struct node *n_ptr); | 202 | u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr); |
203 | void tipc_bclink_check_gap(struct node *n_ptr, u32 seqno); | 203 | void tipc_bclink_check_gap(struct tipc_node *n_ptr, u32 seqno); |
204 | int tipc_bclink_stats(char *stats_buf, const u32 buf_size); | 204 | int tipc_bclink_stats(char *stats_buf, const u32 buf_size); |
205 | int tipc_bclink_reset_stats(void); | 205 | int tipc_bclink_reset_stats(void); |
206 | int tipc_bclink_set_queue_limits(u32 limit); | 206 | int tipc_bclink_set_queue_limits(u32 limit); |
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 6a9aba3edd08..a7a36779b9b3 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -599,7 +599,7 @@ int tipc_block_bearer(const char *name) | |||
599 | spin_lock_bh(&b_ptr->publ.lock); | 599 | spin_lock_bh(&b_ptr->publ.lock); |
600 | b_ptr->publ.blocked = 1; | 600 | b_ptr->publ.blocked = 1; |
601 | list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { | 601 | list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { |
602 | struct node *n_ptr = l_ptr->owner; | 602 | struct tipc_node *n_ptr = l_ptr->owner; |
603 | 603 | ||
604 | spin_lock_bh(&n_ptr->lock); | 604 | spin_lock_bh(&n_ptr->lock); |
605 | tipc_link_reset(l_ptr); | 605 | tipc_link_reset(l_ptr); |
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index 6a36b6600e6c..ca5734892713 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h | |||
@@ -104,7 +104,7 @@ struct bearer { | |||
104 | u32 continue_count; | 104 | u32 continue_count; |
105 | int active; | 105 | int active; |
106 | char net_plane; | 106 | char net_plane; |
107 | struct node_map nodes; | 107 | struct tipc_node_map nodes; |
108 | }; | 108 | }; |
109 | 109 | ||
110 | struct bearer_name { | 110 | struct bearer_name { |
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c index 46ee6c58532d..689fdefe9d04 100644 --- a/net/tipc/cluster.c +++ b/net/tipc/cluster.c | |||
@@ -48,8 +48,8 @@ static void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf, | |||
48 | u32 lower, u32 upper); | 48 | u32 lower, u32 upper); |
49 | static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest); | 49 | static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest); |
50 | 50 | ||
51 | struct node **tipc_local_nodes = NULL; | 51 | struct tipc_node **tipc_local_nodes = NULL; |
52 | struct node_map tipc_cltr_bcast_nodes = {0,{0,}}; | 52 | struct tipc_node_map tipc_cltr_bcast_nodes = {0,{0,}}; |
53 | u32 tipc_highest_allowed_slave = 0; | 53 | u32 tipc_highest_allowed_slave = 0; |
54 | 54 | ||
55 | struct cluster *tipc_cltr_create(u32 addr) | 55 | struct cluster *tipc_cltr_create(u32 addr) |
@@ -115,7 +115,7 @@ void tipc_cltr_delete(struct cluster *c_ptr) | |||
115 | 115 | ||
116 | u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr) | 116 | u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr) |
117 | { | 117 | { |
118 | struct node *n_ptr; | 118 | struct tipc_node *n_ptr; |
119 | u32 n_num = tipc_node(addr) + 1; | 119 | u32 n_num = tipc_node(addr) + 1; |
120 | 120 | ||
121 | if (!c_ptr) | 121 | if (!c_ptr) |
@@ -133,7 +133,7 @@ u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr) | |||
133 | return 0; | 133 | return 0; |
134 | } | 134 | } |
135 | 135 | ||
136 | void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr) | 136 | void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr) |
137 | { | 137 | { |
138 | u32 n_num = tipc_node(n_ptr->addr); | 138 | u32 n_num = tipc_node(n_ptr->addr); |
139 | u32 max_n_num = tipc_max_nodes; | 139 | u32 max_n_num = tipc_max_nodes; |
@@ -196,7 +196,7 @@ u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref) | |||
196 | * Uses deterministic and fair algorithm. | 196 | * Uses deterministic and fair algorithm. |
197 | */ | 197 | */ |
198 | 198 | ||
199 | struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector) | 199 | struct tipc_node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector) |
200 | { | 200 | { |
201 | u32 n_num; | 201 | u32 n_num; |
202 | u32 mask = tipc_max_nodes; | 202 | u32 mask = tipc_max_nodes; |
@@ -379,7 +379,7 @@ void tipc_cltr_recv_routing_table(struct sk_buff *buf) | |||
379 | { | 379 | { |
380 | struct tipc_msg *msg = buf_msg(buf); | 380 | struct tipc_msg *msg = buf_msg(buf); |
381 | struct cluster *c_ptr; | 381 | struct cluster *c_ptr; |
382 | struct node *n_ptr; | 382 | struct tipc_node *n_ptr; |
383 | unchar *node_table; | 383 | unchar *node_table; |
384 | u32 table_size; | 384 | u32 table_size; |
385 | u32 router; | 385 | u32 router; |
@@ -499,7 +499,7 @@ static void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf, | |||
499 | u32 lower, u32 upper) | 499 | u32 lower, u32 upper) |
500 | { | 500 | { |
501 | struct sk_buff *buf_copy; | 501 | struct sk_buff *buf_copy; |
502 | struct node *n_ptr; | 502 | struct tipc_node *n_ptr; |
503 | u32 n_num; | 503 | u32 n_num; |
504 | u32 tstop; | 504 | u32 tstop; |
505 | 505 | ||
@@ -534,7 +534,7 @@ void tipc_cltr_broadcast(struct sk_buff *buf) | |||
534 | { | 534 | { |
535 | struct sk_buff *buf_copy; | 535 | struct sk_buff *buf_copy; |
536 | struct cluster *c_ptr; | 536 | struct cluster *c_ptr; |
537 | struct node *n_ptr; | 537 | struct tipc_node *n_ptr; |
538 | u32 n_num; | 538 | u32 n_num; |
539 | u32 tstart; | 539 | u32 tstart; |
540 | u32 tstop; | 540 | u32 tstop; |
diff --git a/net/tipc/cluster.h b/net/tipc/cluster.h index 62df074afaec..333efb0b9c44 100644 --- a/net/tipc/cluster.h +++ b/net/tipc/cluster.h | |||
@@ -54,24 +54,24 @@ | |||
54 | struct cluster { | 54 | struct cluster { |
55 | u32 addr; | 55 | u32 addr; |
56 | struct _zone *owner; | 56 | struct _zone *owner; |
57 | struct node **nodes; | 57 | struct tipc_node **nodes; |
58 | u32 highest_node; | 58 | u32 highest_node; |
59 | u32 highest_slave; | 59 | u32 highest_slave; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | 62 | ||
63 | extern struct node **tipc_local_nodes; | 63 | extern struct tipc_node **tipc_local_nodes; |
64 | extern u32 tipc_highest_allowed_slave; | 64 | extern u32 tipc_highest_allowed_slave; |
65 | extern struct node_map tipc_cltr_bcast_nodes; | 65 | extern struct tipc_node_map tipc_cltr_bcast_nodes; |
66 | 66 | ||
67 | void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router); | 67 | void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router); |
68 | void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest); | 68 | void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest); |
69 | struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector); | 69 | struct tipc_node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector); |
70 | u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref); | 70 | u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref); |
71 | void tipc_cltr_recv_routing_table(struct sk_buff *buf); | 71 | void tipc_cltr_recv_routing_table(struct sk_buff *buf); |
72 | struct cluster *tipc_cltr_create(u32 addr); | 72 | struct cluster *tipc_cltr_create(u32 addr); |
73 | void tipc_cltr_delete(struct cluster *c_ptr); | 73 | void tipc_cltr_delete(struct cluster *c_ptr); |
74 | void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr); | 74 | void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr); |
75 | void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest); | 75 | void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest); |
76 | void tipc_cltr_broadcast(struct sk_buff *buf); | 76 | void tipc_cltr_broadcast(struct sk_buff *buf); |
77 | int tipc_cltr_init(void); | 77 | int tipc_cltr_init(void); |
diff --git a/net/tipc/discover.c b/net/tipc/discover.c index 1657f0e795ff..74b7d1e28aec 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c | |||
@@ -193,7 +193,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr) | |||
193 | /* Always accept link here */ | 193 | /* Always accept link here */ |
194 | struct sk_buff *rbuf; | 194 | struct sk_buff *rbuf; |
195 | struct tipc_media_addr *addr; | 195 | struct tipc_media_addr *addr; |
196 | struct node *n_ptr = tipc_node_find(orig); | 196 | struct tipc_node *n_ptr = tipc_node_find(orig); |
197 | int link_fully_up; | 197 | int link_fully_up; |
198 | 198 | ||
199 | dbg(" in own cluster\n"); | 199 | dbg(" in own cluster\n"); |
diff --git a/net/tipc/link.c b/net/tipc/link.c index d60113ba4b1b..dd4c18b9a35b 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -1155,7 +1155,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) | |||
1155 | int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector) | 1155 | int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector) |
1156 | { | 1156 | { |
1157 | struct link *l_ptr; | 1157 | struct link *l_ptr; |
1158 | struct node *n_ptr; | 1158 | struct tipc_node *n_ptr; |
1159 | int res = -ELINKCONG; | 1159 | int res = -ELINKCONG; |
1160 | 1160 | ||
1161 | read_lock_bh(&tipc_net_lock); | 1161 | read_lock_bh(&tipc_net_lock); |
@@ -1226,7 +1226,7 @@ static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, | |||
1226 | int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode) | 1226 | int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode) |
1227 | { | 1227 | { |
1228 | struct link *l_ptr; | 1228 | struct link *l_ptr; |
1229 | struct node *n_ptr; | 1229 | struct tipc_node *n_ptr; |
1230 | int res; | 1230 | int res; |
1231 | u32 selector = msg_origport(buf_msg(buf)) & 1; | 1231 | u32 selector = msg_origport(buf_msg(buf)) & 1; |
1232 | u32 dummy; | 1232 | u32 dummy; |
@@ -1270,7 +1270,7 @@ int tipc_link_send_sections_fast(struct port *sender, | |||
1270 | struct tipc_msg *hdr = &sender->publ.phdr; | 1270 | struct tipc_msg *hdr = &sender->publ.phdr; |
1271 | struct link *l_ptr; | 1271 | struct link *l_ptr; |
1272 | struct sk_buff *buf; | 1272 | struct sk_buff *buf; |
1273 | struct node *node; | 1273 | struct tipc_node *node; |
1274 | int res; | 1274 | int res; |
1275 | u32 selector = msg_origport(hdr) & 1; | 1275 | u32 selector = msg_origport(hdr) & 1; |
1276 | 1276 | ||
@@ -1364,7 +1364,7 @@ static int link_send_sections_long(struct port *sender, | |||
1364 | u32 destaddr) | 1364 | u32 destaddr) |
1365 | { | 1365 | { |
1366 | struct link *l_ptr; | 1366 | struct link *l_ptr; |
1367 | struct node *node; | 1367 | struct tipc_node *node; |
1368 | struct tipc_msg *hdr = &sender->publ.phdr; | 1368 | struct tipc_msg *hdr = &sender->publ.phdr; |
1369 | u32 dsz = msg_data_sz(hdr); | 1369 | u32 dsz = msg_data_sz(hdr); |
1370 | u32 max_pkt,fragm_sz,rest; | 1370 | u32 max_pkt,fragm_sz,rest; |
@@ -1636,7 +1636,7 @@ void tipc_link_push_queue(struct link *l_ptr) | |||
1636 | 1636 | ||
1637 | static void link_reset_all(unsigned long addr) | 1637 | static void link_reset_all(unsigned long addr) |
1638 | { | 1638 | { |
1639 | struct node *n_ptr; | 1639 | struct tipc_node *n_ptr; |
1640 | char addr_string[16]; | 1640 | char addr_string[16]; |
1641 | u32 i; | 1641 | u32 i; |
1642 | 1642 | ||
@@ -1682,7 +1682,7 @@ static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf) | |||
1682 | 1682 | ||
1683 | /* Handle failure on broadcast link */ | 1683 | /* Handle failure on broadcast link */ |
1684 | 1684 | ||
1685 | struct node *n_ptr; | 1685 | struct tipc_node *n_ptr; |
1686 | char addr_string[16]; | 1686 | char addr_string[16]; |
1687 | 1687 | ||
1688 | tipc_printf(TIPC_OUTPUT, "Msg seq number: %u, ", msg_seqno(msg)); | 1688 | tipc_printf(TIPC_OUTPUT, "Msg seq number: %u, ", msg_seqno(msg)); |
@@ -1843,7 +1843,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) | |||
1843 | read_lock_bh(&tipc_net_lock); | 1843 | read_lock_bh(&tipc_net_lock); |
1844 | while (head) { | 1844 | while (head) { |
1845 | struct bearer *b_ptr = (struct bearer *)tb_ptr; | 1845 | struct bearer *b_ptr = (struct bearer *)tb_ptr; |
1846 | struct node *n_ptr; | 1846 | struct tipc_node *n_ptr; |
1847 | struct link *l_ptr; | 1847 | struct link *l_ptr; |
1848 | struct sk_buff *crs; | 1848 | struct sk_buff *crs; |
1849 | struct sk_buff *buf = head; | 1849 | struct sk_buff *buf = head; |
@@ -2935,7 +2935,7 @@ void tipc_link_set_queue_limits(struct link *l_ptr, u32 window) | |||
2935 | * Returns pointer to link (or 0 if invalid link name). | 2935 | * Returns pointer to link (or 0 if invalid link name). |
2936 | */ | 2936 | */ |
2937 | 2937 | ||
2938 | static struct link *link_find_link(const char *name, struct node **node) | 2938 | static struct link *link_find_link(const char *name, struct tipc_node **node) |
2939 | { | 2939 | { |
2940 | struct link_name link_name_parts; | 2940 | struct link_name link_name_parts; |
2941 | struct bearer *b_ptr; | 2941 | struct bearer *b_ptr; |
@@ -2965,7 +2965,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space | |||
2965 | struct tipc_link_config *args; | 2965 | struct tipc_link_config *args; |
2966 | u32 new_value; | 2966 | u32 new_value; |
2967 | struct link *l_ptr; | 2967 | struct link *l_ptr; |
2968 | struct node *node; | 2968 | struct tipc_node *node; |
2969 | int res; | 2969 | int res; |
2970 | 2970 | ||
2971 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG)) | 2971 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG)) |
@@ -3043,7 +3043,7 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_ | |||
3043 | { | 3043 | { |
3044 | char *link_name; | 3044 | char *link_name; |
3045 | struct link *l_ptr; | 3045 | struct link *l_ptr; |
3046 | struct node *node; | 3046 | struct tipc_node *node; |
3047 | 3047 | ||
3048 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) | 3048 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) |
3049 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 3049 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
@@ -3091,7 +3091,7 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) | |||
3091 | { | 3091 | { |
3092 | struct print_buf pb; | 3092 | struct print_buf pb; |
3093 | struct link *l_ptr; | 3093 | struct link *l_ptr; |
3094 | struct node *node; | 3094 | struct tipc_node *node; |
3095 | char *status; | 3095 | char *status; |
3096 | u32 profile_total = 0; | 3096 | u32 profile_total = 0; |
3097 | 3097 | ||
@@ -3207,7 +3207,7 @@ int link_control(const char *name, u32 op, u32 val) | |||
3207 | int res = -EINVAL; | 3207 | int res = -EINVAL; |
3208 | struct link *l_ptr; | 3208 | struct link *l_ptr; |
3209 | u32 bearer_id; | 3209 | u32 bearer_id; |
3210 | struct node * node; | 3210 | struct tipc_node * node; |
3211 | u32 a; | 3211 | u32 a; |
3212 | 3212 | ||
3213 | a = link_name2addr(name, &bearer_id); | 3213 | a = link_name2addr(name, &bearer_id); |
@@ -3249,7 +3249,7 @@ int link_control(const char *name, u32 op, u32 val) | |||
3249 | 3249 | ||
3250 | u32 tipc_link_get_max_pkt(u32 dest, u32 selector) | 3250 | u32 tipc_link_get_max_pkt(u32 dest, u32 selector) |
3251 | { | 3251 | { |
3252 | struct node *n_ptr; | 3252 | struct tipc_node *n_ptr; |
3253 | struct link *l_ptr; | 3253 | struct link *l_ptr; |
3254 | u32 res = MAX_PKT_DEFAULT; | 3254 | u32 res = MAX_PKT_DEFAULT; |
3255 | 3255 | ||
diff --git a/net/tipc/link.h b/net/tipc/link.h index 52f3e7c1871f..6a51e38ad25c 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h | |||
@@ -116,7 +116,7 @@ struct link { | |||
116 | char name[TIPC_MAX_LINK_NAME]; | 116 | char name[TIPC_MAX_LINK_NAME]; |
117 | struct tipc_media_addr media_addr; | 117 | struct tipc_media_addr media_addr; |
118 | struct timer_list timer; | 118 | struct timer_list timer; |
119 | struct node *owner; | 119 | struct tipc_node *owner; |
120 | struct list_head link_list; | 120 | struct list_head link_list; |
121 | 121 | ||
122 | /* Management and link supervision data */ | 122 | /* Management and link supervision data */ |
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h index b9e7cd336d76..139882d4ed00 100644 --- a/net/tipc/name_table.h +++ b/net/tipc/name_table.h | |||
@@ -76,7 +76,7 @@ struct publication { | |||
76 | u32 node; | 76 | u32 node; |
77 | u32 ref; | 77 | u32 ref; |
78 | u32 key; | 78 | u32 key; |
79 | struct node_subscr subscr; | 79 | struct tipc_node_subscr subscr; |
80 | struct list_head local_list; | 80 | struct list_head local_list; |
81 | struct list_head pport_list; | 81 | struct list_head pport_list; |
82 | struct publication *node_list_next; | 82 | struct publication *node_list_next; |
diff --git a/net/tipc/net.c b/net/tipc/net.c index ec7b04fbdc43..7906608bf510 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c | |||
@@ -118,7 +118,7 @@ | |||
118 | DEFINE_RWLOCK(tipc_net_lock); | 118 | DEFINE_RWLOCK(tipc_net_lock); |
119 | struct network tipc_net = { NULL }; | 119 | struct network tipc_net = { NULL }; |
120 | 120 | ||
121 | struct node *tipc_net_select_remote_node(u32 addr, u32 ref) | 121 | struct tipc_node *tipc_net_select_remote_node(u32 addr, u32 ref) |
122 | { | 122 | { |
123 | return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref); | 123 | return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref); |
124 | } | 124 | } |
diff --git a/net/tipc/net.h b/net/tipc/net.h index d154ac2bda9a..de2b9ad8f646 100644 --- a/net/tipc/net.h +++ b/net/tipc/net.h | |||
@@ -55,7 +55,7 @@ extern rwlock_t tipc_net_lock; | |||
55 | void tipc_net_remove_as_router(u32 router); | 55 | void tipc_net_remove_as_router(u32 router); |
56 | void tipc_net_send_external_routes(u32 dest); | 56 | void tipc_net_send_external_routes(u32 dest); |
57 | void tipc_net_route_msg(struct sk_buff *buf); | 57 | void tipc_net_route_msg(struct sk_buff *buf); |
58 | struct node *tipc_net_select_remote_node(u32 addr, u32 ref); | 58 | struct tipc_node *tipc_net_select_remote_node(u32 addr, u32 ref); |
59 | u32 tipc_net_select_router(u32 addr, u32 ref); | 59 | u32 tipc_net_select_router(u32 addr, u32 ref); |
60 | 60 | ||
61 | int tipc_net_start(u32 addr); | 61 | int tipc_net_start(u32 addr); |
diff --git a/net/tipc/node.c b/net/tipc/node.c index ee952ad60218..20d98c56e152 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -46,11 +46,11 @@ | |||
46 | #include "bearer.h" | 46 | #include "bearer.h" |
47 | #include "name_distr.h" | 47 | #include "name_distr.h" |
48 | 48 | ||
49 | void node_print(struct print_buf *buf, struct node *n_ptr, char *str); | 49 | void node_print(struct print_buf *buf, struct tipc_node *n_ptr, char *str); |
50 | static void node_lost_contact(struct node *n_ptr); | 50 | static void node_lost_contact(struct tipc_node *n_ptr); |
51 | static void node_established_contact(struct node *n_ptr); | 51 | static void node_established_contact(struct tipc_node *n_ptr); |
52 | 52 | ||
53 | struct node *tipc_nodes = NULL; /* sorted list of nodes within cluster */ | 53 | struct tipc_node *tipc_nodes = NULL; /* sorted list of nodes within cluster */ |
54 | 54 | ||
55 | static DEFINE_SPINLOCK(node_create_lock); | 55 | static DEFINE_SPINLOCK(node_create_lock); |
56 | 56 | ||
@@ -66,11 +66,11 @@ u32 tipc_own_tag = 0; | |||
66 | * but this is a non-trivial change.) | 66 | * but this is a non-trivial change.) |
67 | */ | 67 | */ |
68 | 68 | ||
69 | struct node *tipc_node_create(u32 addr) | 69 | struct tipc_node *tipc_node_create(u32 addr) |
70 | { | 70 | { |
71 | struct cluster *c_ptr; | 71 | struct cluster *c_ptr; |
72 | struct node *n_ptr; | 72 | struct tipc_node *n_ptr; |
73 | struct node **curr_node; | 73 | struct tipc_node **curr_node; |
74 | 74 | ||
75 | spin_lock_bh(&node_create_lock); | 75 | spin_lock_bh(&node_create_lock); |
76 | 76 | ||
@@ -120,7 +120,7 @@ struct node *tipc_node_create(u32 addr) | |||
120 | return n_ptr; | 120 | return n_ptr; |
121 | } | 121 | } |
122 | 122 | ||
123 | void tipc_node_delete(struct node *n_ptr) | 123 | void tipc_node_delete(struct tipc_node *n_ptr) |
124 | { | 124 | { |
125 | if (!n_ptr) | 125 | if (!n_ptr) |
126 | return; | 126 | return; |
@@ -146,7 +146,7 @@ void tipc_node_delete(struct node *n_ptr) | |||
146 | * Link becomes active (alone or shared) or standby, depending on its priority. | 146 | * Link becomes active (alone or shared) or standby, depending on its priority. |
147 | */ | 147 | */ |
148 | 148 | ||
149 | void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr) | 149 | void tipc_node_link_up(struct tipc_node *n_ptr, struct link *l_ptr) |
150 | { | 150 | { |
151 | struct link **active = &n_ptr->active_links[0]; | 151 | struct link **active = &n_ptr->active_links[0]; |
152 | 152 | ||
@@ -180,7 +180,7 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr) | |||
180 | * node_select_active_links - select active link | 180 | * node_select_active_links - select active link |
181 | */ | 181 | */ |
182 | 182 | ||
183 | static void node_select_active_links(struct node *n_ptr) | 183 | static void node_select_active_links(struct tipc_node *n_ptr) |
184 | { | 184 | { |
185 | struct link **active = &n_ptr->active_links[0]; | 185 | struct link **active = &n_ptr->active_links[0]; |
186 | u32 i; | 186 | u32 i; |
@@ -208,7 +208,7 @@ static void node_select_active_links(struct node *n_ptr) | |||
208 | * tipc_node_link_down - handle loss of link | 208 | * tipc_node_link_down - handle loss of link |
209 | */ | 209 | */ |
210 | 210 | ||
211 | void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr) | 211 | void tipc_node_link_down(struct tipc_node *n_ptr, struct link *l_ptr) |
212 | { | 212 | { |
213 | struct link **active; | 213 | struct link **active; |
214 | 214 | ||
@@ -235,30 +235,30 @@ void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr) | |||
235 | node_lost_contact(n_ptr); | 235 | node_lost_contact(n_ptr); |
236 | } | 236 | } |
237 | 237 | ||
238 | int tipc_node_has_active_links(struct node *n_ptr) | 238 | int tipc_node_has_active_links(struct tipc_node *n_ptr) |
239 | { | 239 | { |
240 | return (n_ptr && | 240 | return (n_ptr && |
241 | ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); | 241 | ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); |
242 | } | 242 | } |
243 | 243 | ||
244 | int tipc_node_has_redundant_links(struct node *n_ptr) | 244 | int tipc_node_has_redundant_links(struct tipc_node *n_ptr) |
245 | { | 245 | { |
246 | return (n_ptr->working_links > 1); | 246 | return (n_ptr->working_links > 1); |
247 | } | 247 | } |
248 | 248 | ||
249 | static int tipc_node_has_active_routes(struct node *n_ptr) | 249 | static int tipc_node_has_active_routes(struct tipc_node *n_ptr) |
250 | { | 250 | { |
251 | return (n_ptr && (n_ptr->last_router >= 0)); | 251 | return (n_ptr && (n_ptr->last_router >= 0)); |
252 | } | 252 | } |
253 | 253 | ||
254 | int tipc_node_is_up(struct node *n_ptr) | 254 | int tipc_node_is_up(struct tipc_node *n_ptr) |
255 | { | 255 | { |
256 | return (tipc_node_has_active_links(n_ptr) || tipc_node_has_active_routes(n_ptr)); | 256 | return (tipc_node_has_active_links(n_ptr) || tipc_node_has_active_routes(n_ptr)); |
257 | } | 257 | } |
258 | 258 | ||
259 | struct node *tipc_node_attach_link(struct link *l_ptr) | 259 | struct tipc_node *tipc_node_attach_link(struct link *l_ptr) |
260 | { | 260 | { |
261 | struct node *n_ptr = tipc_node_find(l_ptr->addr); | 261 | struct tipc_node *n_ptr = tipc_node_find(l_ptr->addr); |
262 | 262 | ||
263 | if (!n_ptr) | 263 | if (!n_ptr) |
264 | n_ptr = tipc_node_create(l_ptr->addr); | 264 | n_ptr = tipc_node_create(l_ptr->addr); |
@@ -285,7 +285,7 @@ struct node *tipc_node_attach_link(struct link *l_ptr) | |||
285 | return NULL; | 285 | return NULL; |
286 | } | 286 | } |
287 | 287 | ||
288 | void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) | 288 | void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr) |
289 | { | 289 | { |
290 | n_ptr->links[l_ptr->b_ptr->identity] = NULL; | 290 | n_ptr->links[l_ptr->b_ptr->identity] = NULL; |
291 | tipc_net.zones[tipc_zone(l_ptr->addr)]->links--; | 291 | tipc_net.zones[tipc_zone(l_ptr->addr)]->links--; |
@@ -338,7 +338,7 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) | |||
338 | * | 338 | * |
339 | */ | 339 | */ |
340 | 340 | ||
341 | static void node_established_contact(struct node *n_ptr) | 341 | static void node_established_contact(struct tipc_node *n_ptr) |
342 | { | 342 | { |
343 | struct cluster *c_ptr; | 343 | struct cluster *c_ptr; |
344 | 344 | ||
@@ -384,10 +384,10 @@ static void node_established_contact(struct node *n_ptr) | |||
384 | tipc_highest_allowed_slave); | 384 | tipc_highest_allowed_slave); |
385 | } | 385 | } |
386 | 386 | ||
387 | static void node_lost_contact(struct node *n_ptr) | 387 | static void node_lost_contact(struct tipc_node *n_ptr) |
388 | { | 388 | { |
389 | struct cluster *c_ptr; | 389 | struct cluster *c_ptr; |
390 | struct node_subscr *ns, *tns; | 390 | struct tipc_node_subscr *ns, *tns; |
391 | char addr_string[16]; | 391 | char addr_string[16]; |
392 | u32 i; | 392 | u32 i; |
393 | 393 | ||
@@ -466,9 +466,9 @@ static void node_lost_contact(struct node *n_ptr) | |||
466 | * Called by when cluster local lookup has failed. | 466 | * Called by when cluster local lookup has failed. |
467 | */ | 467 | */ |
468 | 468 | ||
469 | struct node *tipc_node_select_next_hop(u32 addr, u32 selector) | 469 | struct tipc_node *tipc_node_select_next_hop(u32 addr, u32 selector) |
470 | { | 470 | { |
471 | struct node *n_ptr; | 471 | struct tipc_node *n_ptr; |
472 | u32 router_addr; | 472 | u32 router_addr; |
473 | 473 | ||
474 | if (!tipc_addr_domain_valid(addr)) | 474 | if (!tipc_addr_domain_valid(addr)) |
@@ -513,7 +513,7 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector) | |||
513 | * Uses a deterministic and fair algorithm for selecting router node. | 513 | * Uses a deterministic and fair algorithm for selecting router node. |
514 | */ | 514 | */ |
515 | 515 | ||
516 | u32 tipc_node_select_router(struct node *n_ptr, u32 ref) | 516 | u32 tipc_node_select_router(struct tipc_node *n_ptr, u32 ref) |
517 | { | 517 | { |
518 | u32 ulim; | 518 | u32 ulim; |
519 | u32 mask; | 519 | u32 mask; |
@@ -551,7 +551,7 @@ u32 tipc_node_select_router(struct node *n_ptr, u32 ref) | |||
551 | return tipc_addr(own_zone(), own_cluster(), r); | 551 | return tipc_addr(own_zone(), own_cluster(), r); |
552 | } | 552 | } |
553 | 553 | ||
554 | void tipc_node_add_router(struct node *n_ptr, u32 router) | 554 | void tipc_node_add_router(struct tipc_node *n_ptr, u32 router) |
555 | { | 555 | { |
556 | u32 r_num = tipc_node(router); | 556 | u32 r_num = tipc_node(router); |
557 | 557 | ||
@@ -562,7 +562,7 @@ void tipc_node_add_router(struct node *n_ptr, u32 router) | |||
562 | !n_ptr->routers[n_ptr->last_router]); | 562 | !n_ptr->routers[n_ptr->last_router]); |
563 | } | 563 | } |
564 | 564 | ||
565 | void tipc_node_remove_router(struct node *n_ptr, u32 router) | 565 | void tipc_node_remove_router(struct tipc_node *n_ptr, u32 router) |
566 | { | 566 | { |
567 | u32 r_num = tipc_node(router); | 567 | u32 r_num = tipc_node(router); |
568 | 568 | ||
@@ -580,7 +580,7 @@ void tipc_node_remove_router(struct node *n_ptr, u32 router) | |||
580 | } | 580 | } |
581 | 581 | ||
582 | #if 0 | 582 | #if 0 |
583 | void node_print(struct print_buf *buf, struct node *n_ptr, char *str) | 583 | void node_print(struct print_buf *buf, struct tipc_node *n_ptr, char *str) |
584 | { | 584 | { |
585 | u32 i; | 585 | u32 i; |
586 | 586 | ||
@@ -597,7 +597,7 @@ void node_print(struct print_buf *buf, struct node *n_ptr, char *str) | |||
597 | 597 | ||
598 | u32 tipc_available_nodes(const u32 domain) | 598 | u32 tipc_available_nodes(const u32 domain) |
599 | { | 599 | { |
600 | struct node *n_ptr; | 600 | struct tipc_node *n_ptr; |
601 | u32 cnt = 0; | 601 | u32 cnt = 0; |
602 | 602 | ||
603 | read_lock_bh(&tipc_net_lock); | 603 | read_lock_bh(&tipc_net_lock); |
@@ -615,7 +615,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) | |||
615 | { | 615 | { |
616 | u32 domain; | 616 | u32 domain; |
617 | struct sk_buff *buf; | 617 | struct sk_buff *buf; |
618 | struct node *n_ptr; | 618 | struct tipc_node *n_ptr; |
619 | struct tipc_node_info node_info; | 619 | struct tipc_node_info node_info; |
620 | u32 payload_size; | 620 | u32 payload_size; |
621 | 621 | ||
@@ -667,7 +667,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
667 | { | 667 | { |
668 | u32 domain; | 668 | u32 domain; |
669 | struct sk_buff *buf; | 669 | struct sk_buff *buf; |
670 | struct node *n_ptr; | 670 | struct tipc_node *n_ptr; |
671 | struct tipc_link_info link_info; | 671 | struct tipc_link_info link_info; |
672 | u32 payload_size; | 672 | u32 payload_size; |
673 | 673 | ||
diff --git a/net/tipc/node.h b/net/tipc/node.h index cd1882654bbb..6f990da5d143 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
@@ -43,7 +43,7 @@ | |||
43 | #include "bearer.h" | 43 | #include "bearer.h" |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * struct node - TIPC node structure | 46 | * struct tipc_node - TIPC node structure |
47 | * @addr: network address of node | 47 | * @addr: network address of node |
48 | * @lock: spinlock governing access to structure | 48 | * @lock: spinlock governing access to structure |
49 | * @owner: pointer to cluster that node belongs to | 49 | * @owner: pointer to cluster that node belongs to |
@@ -68,11 +68,11 @@ | |||
68 | * @defragm: list of partially reassembled b'cast message fragments from node | 68 | * @defragm: list of partially reassembled b'cast message fragments from node |
69 | */ | 69 | */ |
70 | 70 | ||
71 | struct node { | 71 | struct tipc_node { |
72 | u32 addr; | 72 | u32 addr; |
73 | spinlock_t lock; | 73 | spinlock_t lock; |
74 | struct cluster *owner; | 74 | struct cluster *owner; |
75 | struct node *next; | 75 | struct tipc_node *next; |
76 | struct list_head nsub; | 76 | struct list_head nsub; |
77 | struct link *active_links[2]; | 77 | struct link *active_links[2]; |
78 | struct link *links[MAX_BEARERS]; | 78 | struct link *links[MAX_BEARERS]; |
@@ -94,26 +94,26 @@ struct node { | |||
94 | } bclink; | 94 | } bclink; |
95 | }; | 95 | }; |
96 | 96 | ||
97 | extern struct node *tipc_nodes; | 97 | extern struct tipc_node *tipc_nodes; |
98 | extern u32 tipc_own_tag; | 98 | extern u32 tipc_own_tag; |
99 | 99 | ||
100 | struct node *tipc_node_create(u32 addr); | 100 | struct tipc_node *tipc_node_create(u32 addr); |
101 | void tipc_node_delete(struct node *n_ptr); | 101 | void tipc_node_delete(struct tipc_node *n_ptr); |
102 | struct node *tipc_node_attach_link(struct link *l_ptr); | 102 | struct tipc_node *tipc_node_attach_link(struct link *l_ptr); |
103 | void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr); | 103 | void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr); |
104 | void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr); | 104 | void tipc_node_link_down(struct tipc_node *n_ptr, struct link *l_ptr); |
105 | void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr); | 105 | void tipc_node_link_up(struct tipc_node *n_ptr, struct link *l_ptr); |
106 | int tipc_node_has_active_links(struct node *n_ptr); | 106 | int tipc_node_has_active_links(struct tipc_node *n_ptr); |
107 | int tipc_node_has_redundant_links(struct node *n_ptr); | 107 | int tipc_node_has_redundant_links(struct tipc_node *n_ptr); |
108 | u32 tipc_node_select_router(struct node *n_ptr, u32 ref); | 108 | u32 tipc_node_select_router(struct tipc_node *n_ptr, u32 ref); |
109 | struct node *tipc_node_select_next_hop(u32 addr, u32 selector); | 109 | struct tipc_node *tipc_node_select_next_hop(u32 addr, u32 selector); |
110 | int tipc_node_is_up(struct node *n_ptr); | 110 | int tipc_node_is_up(struct tipc_node *n_ptr); |
111 | void tipc_node_add_router(struct node *n_ptr, u32 router); | 111 | void tipc_node_add_router(struct tipc_node *n_ptr, u32 router); |
112 | void tipc_node_remove_router(struct node *n_ptr, u32 router); | 112 | void tipc_node_remove_router(struct tipc_node *n_ptr, u32 router); |
113 | struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space); | 113 | struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space); |
114 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space); | 114 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space); |
115 | 115 | ||
116 | static inline struct node *tipc_node_find(u32 addr) | 116 | static inline struct tipc_node *tipc_node_find(u32 addr) |
117 | { | 117 | { |
118 | if (likely(in_own_cluster(addr))) | 118 | if (likely(in_own_cluster(addr))) |
119 | return tipc_local_nodes[tipc_node(addr)]; | 119 | return tipc_local_nodes[tipc_node(addr)]; |
@@ -126,19 +126,19 @@ static inline struct node *tipc_node_find(u32 addr) | |||
126 | return NULL; | 126 | return NULL; |
127 | } | 127 | } |
128 | 128 | ||
129 | static inline struct node *tipc_node_select(u32 addr, u32 selector) | 129 | static inline struct tipc_node *tipc_node_select(u32 addr, u32 selector) |
130 | { | 130 | { |
131 | if (likely(in_own_cluster(addr))) | 131 | if (likely(in_own_cluster(addr))) |
132 | return tipc_local_nodes[tipc_node(addr)]; | 132 | return tipc_local_nodes[tipc_node(addr)]; |
133 | return tipc_node_select_next_hop(addr, selector); | 133 | return tipc_node_select_next_hop(addr, selector); |
134 | } | 134 | } |
135 | 135 | ||
136 | static inline void tipc_node_lock(struct node *n_ptr) | 136 | static inline void tipc_node_lock(struct tipc_node *n_ptr) |
137 | { | 137 | { |
138 | spin_lock_bh(&n_ptr->lock); | 138 | spin_lock_bh(&n_ptr->lock); |
139 | } | 139 | } |
140 | 140 | ||
141 | static inline void tipc_node_unlock(struct node *n_ptr) | 141 | static inline void tipc_node_unlock(struct tipc_node *n_ptr) |
142 | { | 142 | { |
143 | spin_unlock_bh(&n_ptr->lock); | 143 | spin_unlock_bh(&n_ptr->lock); |
144 | } | 144 | } |
diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c index 8ecbd0fb6103..19194d476a9e 100644 --- a/net/tipc/node_subscr.c +++ b/net/tipc/node_subscr.c | |||
@@ -44,7 +44,7 @@ | |||
44 | * tipc_nodesub_subscribe - create "node down" subscription for specified node | 44 | * tipc_nodesub_subscribe - create "node down" subscription for specified node |
45 | */ | 45 | */ |
46 | 46 | ||
47 | void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr, | 47 | void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr, |
48 | void *usr_handle, net_ev_handler handle_down) | 48 | void *usr_handle, net_ev_handler handle_down) |
49 | { | 49 | { |
50 | if (addr == tipc_own_addr) { | 50 | if (addr == tipc_own_addr) { |
@@ -69,7 +69,7 @@ void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr, | |||
69 | * tipc_nodesub_unsubscribe - cancel "node down" subscription (if any) | 69 | * tipc_nodesub_unsubscribe - cancel "node down" subscription (if any) |
70 | */ | 70 | */ |
71 | 71 | ||
72 | void tipc_nodesub_unsubscribe(struct node_subscr *node_sub) | 72 | void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub) |
73 | { | 73 | { |
74 | if (!node_sub->node) | 74 | if (!node_sub->node) |
75 | return; | 75 | return; |
diff --git a/net/tipc/node_subscr.h b/net/tipc/node_subscr.h index 5f3f5859b84c..006ed739f515 100644 --- a/net/tipc/node_subscr.h +++ b/net/tipc/node_subscr.h | |||
@@ -42,22 +42,22 @@ | |||
42 | typedef void (*net_ev_handler) (void *usr_handle); | 42 | typedef void (*net_ev_handler) (void *usr_handle); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * struct node_subscr - "node down" subscription entry | 45 | * struct tipc_node_subscr - "node down" subscription entry |
46 | * @node: ptr to node structure of interest (or NULL, if none) | 46 | * @node: ptr to node structure of interest (or NULL, if none) |
47 | * @handle_node_down: routine to invoke when node fails | 47 | * @handle_node_down: routine to invoke when node fails |
48 | * @usr_handle: argument to pass to routine when node fails | 48 | * @usr_handle: argument to pass to routine when node fails |
49 | * @nodesub_list: adjacent entries in list of subscriptions for the node | 49 | * @nodesub_list: adjacent entries in list of subscriptions for the node |
50 | */ | 50 | */ |
51 | 51 | ||
52 | struct node_subscr { | 52 | struct tipc_node_subscr { |
53 | struct node *node; | 53 | struct tipc_node *node; |
54 | net_ev_handler handle_node_down; | 54 | net_ev_handler handle_node_down; |
55 | void *usr_handle; | 55 | void *usr_handle; |
56 | struct list_head nodesub_list; | 56 | struct list_head nodesub_list; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr, | 59 | void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr, |
60 | void *usr_handle, net_ev_handler handle_down); | 60 | void *usr_handle, net_ev_handler handle_down); |
61 | void tipc_nodesub_unsubscribe(struct node_subscr *node_sub); | 61 | void tipc_nodesub_unsubscribe(struct tipc_node_subscr *node_sub); |
62 | 62 | ||
63 | #endif | 63 | #endif |
diff --git a/net/tipc/port.h b/net/tipc/port.h index e5f8c16429bd..ff31ee4a1dc3 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h | |||
@@ -105,7 +105,7 @@ struct port { | |||
105 | u32 probing_interval; | 105 | u32 probing_interval; |
106 | u32 last_in_seqno; | 106 | u32 last_in_seqno; |
107 | struct timer_list timer; | 107 | struct timer_list timer; |
108 | struct node_subscr subscription; | 108 | struct tipc_node_subscr subscription; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | extern spinlock_t tipc_port_list_lock; | 111 | extern spinlock_t tipc_port_list_lock; |
diff --git a/net/tipc/zone.c b/net/tipc/zone.c index 3506f8563441..2c01ba2d86bf 100644 --- a/net/tipc/zone.c +++ b/net/tipc/zone.c | |||
@@ -111,10 +111,10 @@ void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest) | |||
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref) | 114 | struct tipc_node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref) |
115 | { | 115 | { |
116 | struct cluster *c_ptr; | 116 | struct cluster *c_ptr; |
117 | struct node *n_ptr; | 117 | struct tipc_node *n_ptr; |
118 | u32 c_num; | 118 | u32 c_num; |
119 | 119 | ||
120 | if (!z_ptr) | 120 | if (!z_ptr) |
diff --git a/net/tipc/zone.h b/net/tipc/zone.h index 6e7a08df8af5..7bdc3406ba9b 100644 --- a/net/tipc/zone.h +++ b/net/tipc/zone.h | |||
@@ -54,7 +54,7 @@ struct _zone { | |||
54 | u32 links; | 54 | u32 links; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref); | 57 | struct tipc_node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref); |
58 | u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref); | 58 | u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref); |
59 | void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router); | 59 | void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router); |
60 | void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest); | 60 | void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest); |
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig index ab015c62d561..833b024f8f66 100644 --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig | |||
@@ -39,4 +39,5 @@ config WIRELESS_EXT_SYSFS | |||
39 | files in /sys/class/net/*/wireless/. The same information | 39 | files in /sys/class/net/*/wireless/. The same information |
40 | is available via the ioctls as well. | 40 | is available via the ioctls as well. |
41 | 41 | ||
42 | Say Y if you have programs using it (we don't know of any). | 42 | Say Y if you have programs using it, like old versions of |
43 | hal. | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 841b32a2e680..46914b79d850 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1731,8 +1731,7 @@ restart: | |||
1731 | * We can't enlist stable bundles either. | 1731 | * We can't enlist stable bundles either. |
1732 | */ | 1732 | */ |
1733 | write_unlock_bh(&policy->lock); | 1733 | write_unlock_bh(&policy->lock); |
1734 | if (dst) | 1734 | dst_free(dst); |
1735 | dst_free(dst); | ||
1736 | 1735 | ||
1737 | if (pol_dead) | 1736 | if (pol_dead) |
1738 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTPOLDEAD); | 1737 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTPOLDEAD); |
@@ -1748,8 +1747,7 @@ restart: | |||
1748 | err = xfrm_dst_update_origin(dst, fl); | 1747 | err = xfrm_dst_update_origin(dst, fl); |
1749 | if (unlikely(err)) { | 1748 | if (unlikely(err)) { |
1750 | write_unlock_bh(&policy->lock); | 1749 | write_unlock_bh(&policy->lock); |
1751 | if (dst) | 1750 | dst_free(dst); |
1752 | dst_free(dst); | ||
1753 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTBUNDLECHECKERROR); | 1751 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTBUNDLECHECKERROR); |
1754 | goto error; | 1752 | goto error; |
1755 | } | 1753 | } |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 4c6914ef7d92..7bd62f61593f 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -780,11 +780,13 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
780 | { | 780 | { |
781 | unsigned int h; | 781 | unsigned int h; |
782 | struct hlist_node *entry; | 782 | struct hlist_node *entry; |
783 | struct xfrm_state *x, *x0; | 783 | struct xfrm_state *x, *x0, *to_put; |
784 | int acquire_in_progress = 0; | 784 | int acquire_in_progress = 0; |
785 | int error = 0; | 785 | int error = 0; |
786 | struct xfrm_state *best = NULL; | 786 | struct xfrm_state *best = NULL; |
787 | 787 | ||
788 | to_put = NULL; | ||
789 | |||
788 | spin_lock_bh(&xfrm_state_lock); | 790 | spin_lock_bh(&xfrm_state_lock); |
789 | h = xfrm_dst_hash(daddr, saddr, tmpl->reqid, family); | 791 | h = xfrm_dst_hash(daddr, saddr, tmpl->reqid, family); |
790 | hlist_for_each_entry(x, entry, xfrm_state_bydst+h, bydst) { | 792 | hlist_for_each_entry(x, entry, xfrm_state_bydst+h, bydst) { |
@@ -833,7 +835,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
833 | if (tmpl->id.spi && | 835 | if (tmpl->id.spi && |
834 | (x0 = __xfrm_state_lookup(daddr, tmpl->id.spi, | 836 | (x0 = __xfrm_state_lookup(daddr, tmpl->id.spi, |
835 | tmpl->id.proto, family)) != NULL) { | 837 | tmpl->id.proto, family)) != NULL) { |
836 | xfrm_state_put(x0); | 838 | to_put = x0; |
837 | error = -EEXIST; | 839 | error = -EEXIST; |
838 | goto out; | 840 | goto out; |
839 | } | 841 | } |
@@ -849,7 +851,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
849 | error = security_xfrm_state_alloc_acquire(x, pol->security, fl->secid); | 851 | error = security_xfrm_state_alloc_acquire(x, pol->security, fl->secid); |
850 | if (error) { | 852 | if (error) { |
851 | x->km.state = XFRM_STATE_DEAD; | 853 | x->km.state = XFRM_STATE_DEAD; |
852 | xfrm_state_put(x); | 854 | to_put = x; |
853 | x = NULL; | 855 | x = NULL; |
854 | goto out; | 856 | goto out; |
855 | } | 857 | } |
@@ -870,7 +872,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
870 | xfrm_hash_grow_check(x->bydst.next != NULL); | 872 | xfrm_hash_grow_check(x->bydst.next != NULL); |
871 | } else { | 873 | } else { |
872 | x->km.state = XFRM_STATE_DEAD; | 874 | x->km.state = XFRM_STATE_DEAD; |
873 | xfrm_state_put(x); | 875 | to_put = x; |
874 | x = NULL; | 876 | x = NULL; |
875 | error = -ESRCH; | 877 | error = -ESRCH; |
876 | } | 878 | } |
@@ -881,6 +883,8 @@ out: | |||
881 | else | 883 | else |
882 | *err = acquire_in_progress ? -EAGAIN : error; | 884 | *err = acquire_in_progress ? -EAGAIN : error; |
883 | spin_unlock_bh(&xfrm_state_lock); | 885 | spin_unlock_bh(&xfrm_state_lock); |
886 | if (to_put) | ||
887 | xfrm_state_put(to_put); | ||
884 | return x; | 888 | return x; |
885 | } | 889 | } |
886 | 890 | ||
@@ -1067,18 +1071,20 @@ static struct xfrm_state *__xfrm_find_acq_byseq(u32 seq); | |||
1067 | 1071 | ||
1068 | int xfrm_state_add(struct xfrm_state *x) | 1072 | int xfrm_state_add(struct xfrm_state *x) |
1069 | { | 1073 | { |
1070 | struct xfrm_state *x1; | 1074 | struct xfrm_state *x1, *to_put; |
1071 | int family; | 1075 | int family; |
1072 | int err; | 1076 | int err; |
1073 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); | 1077 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); |
1074 | 1078 | ||
1075 | family = x->props.family; | 1079 | family = x->props.family; |
1076 | 1080 | ||
1081 | to_put = NULL; | ||
1082 | |||
1077 | spin_lock_bh(&xfrm_state_lock); | 1083 | spin_lock_bh(&xfrm_state_lock); |
1078 | 1084 | ||
1079 | x1 = __xfrm_state_locate(x, use_spi, family); | 1085 | x1 = __xfrm_state_locate(x, use_spi, family); |
1080 | if (x1) { | 1086 | if (x1) { |
1081 | xfrm_state_put(x1); | 1087 | to_put = x1; |
1082 | x1 = NULL; | 1088 | x1 = NULL; |
1083 | err = -EEXIST; | 1089 | err = -EEXIST; |
1084 | goto out; | 1090 | goto out; |
@@ -1088,7 +1094,7 @@ int xfrm_state_add(struct xfrm_state *x) | |||
1088 | x1 = __xfrm_find_acq_byseq(x->km.seq); | 1094 | x1 = __xfrm_find_acq_byseq(x->km.seq); |
1089 | if (x1 && ((x1->id.proto != x->id.proto) || | 1095 | if (x1 && ((x1->id.proto != x->id.proto) || |
1090 | xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family))) { | 1096 | xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family))) { |
1091 | xfrm_state_put(x1); | 1097 | to_put = x1; |
1092 | x1 = NULL; | 1098 | x1 = NULL; |
1093 | } | 1099 | } |
1094 | } | 1100 | } |
@@ -1110,6 +1116,9 @@ out: | |||
1110 | xfrm_state_put(x1); | 1116 | xfrm_state_put(x1); |
1111 | } | 1117 | } |
1112 | 1118 | ||
1119 | if (to_put) | ||
1120 | xfrm_state_put(to_put); | ||
1121 | |||
1113 | return err; | 1122 | return err; |
1114 | } | 1123 | } |
1115 | EXPORT_SYMBOL(xfrm_state_add); | 1124 | EXPORT_SYMBOL(xfrm_state_add); |
@@ -1269,10 +1278,12 @@ EXPORT_SYMBOL(xfrm_state_migrate); | |||
1269 | 1278 | ||
1270 | int xfrm_state_update(struct xfrm_state *x) | 1279 | int xfrm_state_update(struct xfrm_state *x) |
1271 | { | 1280 | { |
1272 | struct xfrm_state *x1; | 1281 | struct xfrm_state *x1, *to_put; |
1273 | int err; | 1282 | int err; |
1274 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); | 1283 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); |
1275 | 1284 | ||
1285 | to_put = NULL; | ||
1286 | |||
1276 | spin_lock_bh(&xfrm_state_lock); | 1287 | spin_lock_bh(&xfrm_state_lock); |
1277 | x1 = __xfrm_state_locate(x, use_spi, x->props.family); | 1288 | x1 = __xfrm_state_locate(x, use_spi, x->props.family); |
1278 | 1289 | ||
@@ -1281,7 +1292,7 @@ int xfrm_state_update(struct xfrm_state *x) | |||
1281 | goto out; | 1292 | goto out; |
1282 | 1293 | ||
1283 | if (xfrm_state_kern(x1)) { | 1294 | if (xfrm_state_kern(x1)) { |
1284 | xfrm_state_put(x1); | 1295 | to_put = x1; |
1285 | err = -EEXIST; | 1296 | err = -EEXIST; |
1286 | goto out; | 1297 | goto out; |
1287 | } | 1298 | } |
@@ -1295,6 +1306,9 @@ int xfrm_state_update(struct xfrm_state *x) | |||
1295 | out: | 1306 | out: |
1296 | spin_unlock_bh(&xfrm_state_lock); | 1307 | spin_unlock_bh(&xfrm_state_lock); |
1297 | 1308 | ||
1309 | if (to_put) | ||
1310 | xfrm_state_put(to_put); | ||
1311 | |||
1298 | if (err) | 1312 | if (err) |
1299 | return err; | 1313 | return err; |
1300 | 1314 | ||