aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlanproc.c11
-rw-r--r--net/appletalk/atalk_proc.c15
-rw-r--r--net/atm/br2684.c4
-rw-r--r--net/atm/clip.c4
-rw-r--r--net/atm/lec.c4
-rw-r--r--net/atm/mpoa_proc.c3
-rw-r--r--net/atm/proc.c8
-rw-r--r--net/bluetooth/bnep/bnep.h2
-rw-r--r--net/bluetooth/bnep/sock.c4
-rw-r--r--net/bluetooth/hci_core.c4
-rw-r--r--net/bluetooth/hci_sock.c4
-rw-r--r--net/bluetooth/l2cap.c3
-rw-r--r--net/core/neighbour.c6
-rw-r--r--net/core/netpoll.c12
-rw-r--r--net/core/pktgen.c10
-rw-r--r--net/ipv4/Kconfig2
-rw-r--r--net/ipv4/devinet.c1
-rw-r--r--net/ipv4/ip_gre.c14
-rw-r--r--net/ipv4/ipcomp.c5
-rw-r--r--net/ipv4/ipconfig.c4
-rw-r--r--net/ipv4/ipip.c14
-rw-r--r--net/ipv4/route.c5
-rw-r--r--net/ipv4/tcp_bic.c5
-rw-r--r--net/ipv4/tcp_input.c14
-rw-r--r--net/ipv4/tcp_output.c12
-rw-r--r--net/ipv6/Kconfig2
-rw-r--r--net/ipv6/addrconf.c3
-rw-r--r--net/ipv6/ip6_tunnel.c15
-rw-r--r--net/ipv6/ipcomp6.c2
-rw-r--r--net/ipv6/proc.c4
-rw-r--r--net/ipv6/route.c2
-rw-r--r--net/ipv6/sit.c13
-rw-r--r--net/ipv6/sysctl_net_ipv6.c3
-rw-r--r--net/ipx/ipx_proc.c11
-rw-r--r--net/irda/ircomm/ircomm_core.c8
-rw-r--r--net/irda/irlan/irlan_common.c4
-rw-r--r--net/irda/irproc.c8
-rw-r--r--net/iucv/iucv.c2
-rw-r--r--net/key/af_key.c5
-rw-r--r--net/llc/llc_proc.c8
-rw-r--r--net/mac80211/ieee80211_sta.c7
-rw-r--r--net/mac80211/rc80211_pid_algo.c92
-rw-r--r--net/netfilter/nf_conntrack_core.c15
-rw-r--r--net/netfilter/nf_conntrack_expect.c2
-rw-r--r--net/netfilter/nf_conntrack_extend.c19
-rw-r--r--net/netfilter/nf_queue.c2
-rw-r--r--net/netfilter/nfnetlink_log.c32
-rw-r--r--net/netfilter/nfnetlink_queue.c17
-rw-r--r--net/netfilter/xt_conntrack.c4
-rw-r--r--net/netfilter/xt_time.c7
-rw-r--r--net/rxrpc/ar-recvmsg.c3
-rw-r--r--net/sctp/auth.c4
-rw-r--r--net/sctp/bind_addr.c4
-rw-r--r--net/sctp/ipv6.c16
-rw-r--r--net/sctp/objcnt.c5
-rw-r--r--net/sctp/proc.c13
-rw-r--r--net/sctp/protocol.c16
-rw-r--r--net/sctp/sm_make_chunk.c8
-rw-r--r--net/sctp/socket.c91
-rw-r--r--net/sctp/ulpevent.c2
-rw-r--r--net/sunrpc/cache.c14
-rw-r--r--net/sunrpc/stats.c3
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_sendto.c2
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c96
-rw-r--r--net/sunrpc/xprtrdma/transport.c6
-rw-r--r--net/tipc/cluster.c2
-rw-r--r--net/tipc/link.c2
-rw-r--r--net/tipc/ref.c2
-rw-r--r--net/tipc/zone.c2
-rw-r--r--net/wanrouter/wanproc.c10
-rw-r--r--net/x25/x25_proc.c10
71 files changed, 429 insertions, 339 deletions
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index a0ec47925597..146cfb0e9882 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -161,11 +161,10 @@ int __init vlan_proc_init(void)
161 if (!proc_vlan_dir) 161 if (!proc_vlan_dir)
162 goto err; 162 goto err;
163 163
164 proc_vlan_conf = create_proc_entry(name_conf, S_IFREG|S_IRUSR|S_IWUSR, 164 proc_vlan_conf = proc_create(name_conf, S_IFREG|S_IRUSR|S_IWUSR,
165 proc_vlan_dir); 165 proc_vlan_dir, &vlan_fops);
166 if (!proc_vlan_conf) 166 if (!proc_vlan_conf)
167 goto err; 167 goto err;
168 proc_vlan_conf->proc_fops = &vlan_fops;
169 return 0; 168 return 0;
170 169
171err: 170err:
@@ -182,13 +181,11 @@ int vlan_proc_add_dev(struct net_device *vlandev)
182{ 181{
183 struct vlan_dev_info *dev_info = vlan_dev_info(vlandev); 182 struct vlan_dev_info *dev_info = vlan_dev_info(vlandev);
184 183
185 dev_info->dent = create_proc_entry(vlandev->name, 184 dev_info->dent = proc_create(vlandev->name, S_IFREG|S_IRUSR|S_IWUSR,
186 S_IFREG|S_IRUSR|S_IWUSR, 185 proc_vlan_dir, &vlandev_fops);
187 proc_vlan_dir);
188 if (!dev_info->dent) 186 if (!dev_info->dent)
189 return -ENOBUFS; 187 return -ENOBUFS;
190 188
191 dev_info->dent->proc_fops = &vlandev_fops;
192 dev_info->dent->data = vlandev; 189 dev_info->dent->data = vlandev;
193 return 0; 190 return 0;
194} 191}
diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c
index 8e8dcfd532db..162199a2d74f 100644
--- a/net/appletalk/atalk_proc.c
+++ b/net/appletalk/atalk_proc.c
@@ -283,25 +283,24 @@ int __init atalk_proc_init(void)
283 goto out; 283 goto out;
284 atalk_proc_dir->owner = THIS_MODULE; 284 atalk_proc_dir->owner = THIS_MODULE;
285 285
286 p = create_proc_entry("interface", S_IRUGO, atalk_proc_dir); 286 p = proc_create("interface", S_IRUGO, atalk_proc_dir,
287 &atalk_seq_interface_fops);
287 if (!p) 288 if (!p)
288 goto out_interface; 289 goto out_interface;
289 p->proc_fops = &atalk_seq_interface_fops;
290 290
291 p = create_proc_entry("route", S_IRUGO, atalk_proc_dir); 291 p = proc_create("route", S_IRUGO, atalk_proc_dir,
292 &atalk_seq_route_fops);
292 if (!p) 293 if (!p)
293 goto out_route; 294 goto out_route;
294 p->proc_fops = &atalk_seq_route_fops;
295 295
296 p = create_proc_entry("socket", S_IRUGO, atalk_proc_dir); 296 p = proc_create("socket", S_IRUGO, atalk_proc_dir,
297 &atalk_seq_socket_fops);
297 if (!p) 298 if (!p)
298 goto out_socket; 299 goto out_socket;
299 p->proc_fops = &atalk_seq_socket_fops;
300 300
301 p = create_proc_entry("arp", S_IRUGO, atalk_proc_dir); 301 p = proc_create("arp", S_IRUGO, atalk_proc_dir, &atalk_seq_arp_fops);
302 if (!p) 302 if (!p)
303 goto out_arp; 303 goto out_arp;
304 p->proc_fops = &atalk_seq_arp_fops;
305 304
306 rc = 0; 305 rc = 0;
307out: 306out:
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 574d9a964176..1b228065e745 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -742,9 +742,9 @@ static int __init br2684_init(void)
742{ 742{
743#ifdef CONFIG_PROC_FS 743#ifdef CONFIG_PROC_FS
744 struct proc_dir_entry *p; 744 struct proc_dir_entry *p;
745 if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL) 745 p = proc_create("br2684", 0, atm_proc_root, &br2684_proc_ops);
746 if (p == NULL)
746 return -ENOMEM; 747 return -ENOMEM;
747 p->proc_fops = &br2684_proc_ops;
748#endif 748#endif
749 register_atm_ioctl(&br2684_ioctl_ops); 749 register_atm_ioctl(&br2684_ioctl_ops);
750 return 0; 750 return 0;
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 86b885ec1cbd..d30167c0b48e 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -962,9 +962,7 @@ static int __init atm_clip_init(void)
962 { 962 {
963 struct proc_dir_entry *p; 963 struct proc_dir_entry *p;
964 964
965 p = create_proc_entry("arp", S_IRUGO, atm_proc_root); 965 p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops);
966 if (p)
967 p->proc_fops = &arp_seq_fops;
968 } 966 }
969#endif 967#endif
970 968
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 1a8c4c6c0cd0..0e450d12f035 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1249,9 +1249,7 @@ static int __init lane_module_init(void)
1249#ifdef CONFIG_PROC_FS 1249#ifdef CONFIG_PROC_FS
1250 struct proc_dir_entry *p; 1250 struct proc_dir_entry *p;
1251 1251
1252 p = create_proc_entry("lec", S_IRUGO, atm_proc_root); 1252 p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops);
1253 if (p)
1254 p->proc_fops = &lec_seq_fops;
1255#endif 1253#endif
1256 1254
1257 register_atm_ioctl(&lane_ioctl_ops); 1255 register_atm_ioctl(&lane_ioctl_ops);
diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c
index 91f3ffc90dbd..4990541ef5da 100644
--- a/net/atm/mpoa_proc.c
+++ b/net/atm/mpoa_proc.c
@@ -276,12 +276,11 @@ int mpc_proc_init(void)
276{ 276{
277 struct proc_dir_entry *p; 277 struct proc_dir_entry *p;
278 278
279 p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root); 279 p = proc_create(STAT_FILE_NAME, 0, atm_proc_root, &mpc_file_operations);
280 if (!p) { 280 if (!p) {
281 printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME); 281 printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME);
282 return -ENOMEM; 282 return -ENOMEM;
283 } 283 }
284 p->proc_fops = &mpc_file_operations;
285 p->owner = THIS_MODULE; 284 p->owner = THIS_MODULE;
286 return 0; 285 return 0;
287} 286}
diff --git a/net/atm/proc.c b/net/atm/proc.c
index 49125110bb8b..e9693aed7ef8 100644
--- a/net/atm/proc.c
+++ b/net/atm/proc.c
@@ -435,11 +435,11 @@ int atm_proc_dev_register(struct atm_dev *dev)
435 goto err_out; 435 goto err_out;
436 sprintf(dev->proc_name,"%s:%d",dev->type, dev->number); 436 sprintf(dev->proc_name,"%s:%d",dev->type, dev->number);
437 437
438 dev->proc_entry = create_proc_entry(dev->proc_name, 0, atm_proc_root); 438 dev->proc_entry = proc_create(dev->proc_name, 0, atm_proc_root,
439 &proc_atm_dev_ops);
439 if (!dev->proc_entry) 440 if (!dev->proc_entry)
440 goto err_free_name; 441 goto err_free_name;
441 dev->proc_entry->data = dev; 442 dev->proc_entry->data = dev;
442 dev->proc_entry->proc_fops = &proc_atm_dev_ops;
443 dev->proc_entry->owner = THIS_MODULE; 443 dev->proc_entry->owner = THIS_MODULE;
444 return 0; 444 return 0;
445err_free_name: 445err_free_name:
@@ -492,10 +492,10 @@ int __init atm_proc_init(void)
492 for (e = atm_proc_ents; e->name; e++) { 492 for (e = atm_proc_ents; e->name; e++) {
493 struct proc_dir_entry *dirent; 493 struct proc_dir_entry *dirent;
494 494
495 dirent = create_proc_entry(e->name, S_IRUGO, atm_proc_root); 495 dirent = proc_create(e->name, S_IRUGO,
496 atm_proc_root, e->proc_fops);
496 if (!dirent) 497 if (!dirent)
497 goto err_out_remove; 498 goto err_out_remove;
498 dirent->proc_fops = e->proc_fops;
499 dirent->owner = THIS_MODULE; 499 dirent->owner = THIS_MODULE;
500 e->dirent = dirent; 500 e->dirent = dirent;
501 } 501 }
diff --git a/net/bluetooth/bnep/bnep.h b/net/bluetooth/bnep/bnep.h
index a2992280c3d1..e69244dd8de8 100644
--- a/net/bluetooth/bnep/bnep.h
+++ b/net/bluetooth/bnep/bnep.h
@@ -174,7 +174,7 @@ struct bnep_session {
174 174
175void bnep_net_setup(struct net_device *dev); 175void bnep_net_setup(struct net_device *dev);
176int bnep_sock_init(void); 176int bnep_sock_init(void);
177int bnep_sock_cleanup(void); 177void bnep_sock_cleanup(void);
178 178
179static inline int bnep_mc_hash(__u8 *addr) 179static inline int bnep_mc_hash(__u8 *addr)
180{ 180{
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
index 81065e548a1f..201e5b1ce473 100644
--- a/net/bluetooth/bnep/sock.c
+++ b/net/bluetooth/bnep/sock.c
@@ -257,12 +257,10 @@ error:
257 return err; 257 return err;
258} 258}
259 259
260int __exit bnep_sock_cleanup(void) 260void __exit bnep_sock_cleanup(void)
261{ 261{
262 if (bt_sock_unregister(BTPROTO_BNEP) < 0) 262 if (bt_sock_unregister(BTPROTO_BNEP) < 0)
263 BT_ERR("Can't unregister BNEP socket"); 263 BT_ERR("Can't unregister BNEP socket");
264 264
265 proto_unregister(&bnep_proto); 265 proto_unregister(&bnep_proto);
266
267 return 0;
268} 266}
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 930b58e7149a..aec6929f5c16 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -902,8 +902,6 @@ int hci_unregister_dev(struct hci_dev *hdev)
902 902
903 BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); 903 BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
904 904
905 hci_unregister_sysfs(hdev);
906
907 write_lock_bh(&hci_dev_list_lock); 905 write_lock_bh(&hci_dev_list_lock);
908 list_del(&hdev->list); 906 list_del(&hdev->list);
909 write_unlock_bh(&hci_dev_list_lock); 907 write_unlock_bh(&hci_dev_list_lock);
@@ -915,6 +913,8 @@ int hci_unregister_dev(struct hci_dev *hdev)
915 913
916 hci_notify(hdev, HCI_DEV_UNREG); 914 hci_notify(hdev, HCI_DEV_UNREG);
917 915
916 hci_unregister_sysfs(hdev);
917
918 __hci_dev_put(hdev); 918 __hci_dev_put(hdev);
919 919
920 return 0; 920 return 0;
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 14991323c273..b5d4019d3572 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -734,7 +734,7 @@ error:
734 return err; 734 return err;
735} 735}
736 736
737int __exit hci_sock_cleanup(void) 737void __exit hci_sock_cleanup(void)
738{ 738{
739 if (bt_sock_unregister(BTPROTO_HCI) < 0) 739 if (bt_sock_unregister(BTPROTO_HCI) < 0)
740 BT_ERR("HCI socket unregistration failed"); 740 BT_ERR("HCI socket unregistration failed");
@@ -742,6 +742,4 @@ int __exit hci_sock_cleanup(void)
742 hci_unregister_notifier(&hci_sock_nblock); 742 hci_unregister_notifier(&hci_sock_nblock);
743 743
744 proto_unregister(&hci_sk_proto); 744 proto_unregister(&hci_sk_proto);
745
746 return 0;
747} 745}
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index a8811c0a0cea..34f8bf98bc05 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -417,6 +417,9 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
417 l2cap_sock_kill(sk); 417 l2cap_sock_kill(sk);
418 } 418 }
419 419
420 if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT)
421 del_timer_sync(&conn->info_timer);
422
420 hcon->l2cap_data = NULL; 423 hcon->l2cap_data = NULL;
421 kfree(conn); 424 kfree(conn);
422} 425}
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 2328acbd16cd..d9a02b2cc289 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -839,7 +839,7 @@ static void neigh_timer_handler(unsigned long arg)
839 struct sk_buff *skb = skb_peek(&neigh->arp_queue); 839 struct sk_buff *skb = skb_peek(&neigh->arp_queue);
840 /* keep skb alive even if arp_queue overflows */ 840 /* keep skb alive even if arp_queue overflows */
841 if (skb) 841 if (skb)
842 skb_get(skb); 842 skb = skb_copy(skb, GFP_ATOMIC);
843 write_unlock(&neigh->lock); 843 write_unlock(&neigh->lock);
844 neigh->ops->solicit(neigh, skb); 844 neigh->ops->solicit(neigh, skb);
845 atomic_inc(&neigh->probes); 845 atomic_inc(&neigh->probes);
@@ -1389,10 +1389,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
1389 panic("cannot create neighbour cache statistics"); 1389 panic("cannot create neighbour cache statistics");
1390 1390
1391#ifdef CONFIG_PROC_FS 1391#ifdef CONFIG_PROC_FS
1392 tbl->pde = create_proc_entry(tbl->id, 0, init_net.proc_net_stat); 1392 tbl->pde = proc_create(tbl->id, 0, init_net.proc_net_stat,
1393 &neigh_stat_seq_fops);
1393 if (!tbl->pde) 1394 if (!tbl->pde)
1394 panic("cannot create neighbour proc dir entry"); 1395 panic("cannot create neighbour proc dir entry");
1395 tbl->pde->proc_fops = &neigh_stat_seq_fops;
1396 tbl->pde->data = tbl; 1396 tbl->pde->data = tbl;
1397#endif 1397#endif
1398 1398
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 6faa128a4c8e..4b7e756181c9 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -39,6 +39,8 @@ static struct sk_buff_head skb_pool;
39static atomic_t trapped; 39static atomic_t trapped;
40 40
41#define USEC_PER_POLL 50 41#define USEC_PER_POLL 50
42#define NETPOLL_RX_ENABLED 1
43#define NETPOLL_RX_DROP 2
42 44
43#define MAX_SKB_SIZE \ 45#define MAX_SKB_SIZE \
44 (MAX_UDP_CHUNK + sizeof(struct udphdr) + \ 46 (MAX_UDP_CHUNK + sizeof(struct udphdr) + \
@@ -126,11 +128,13 @@ static int poll_one_napi(struct netpoll_info *npinfo,
126 if (!test_bit(NAPI_STATE_SCHED, &napi->state)) 128 if (!test_bit(NAPI_STATE_SCHED, &napi->state))
127 return budget; 129 return budget;
128 130
131 npinfo->rx_flags |= NETPOLL_RX_DROP;
129 atomic_inc(&trapped); 132 atomic_inc(&trapped);
130 133
131 work = napi->poll(napi, budget); 134 work = napi->poll(napi, budget);
132 135
133 atomic_dec(&trapped); 136 atomic_dec(&trapped);
137 npinfo->rx_flags &= ~NETPOLL_RX_DROP;
134 138
135 return budget - work; 139 return budget - work;
136} 140}
@@ -472,7 +476,7 @@ int __netpoll_rx(struct sk_buff *skb)
472 if (skb->dev->type != ARPHRD_ETHER) 476 if (skb->dev->type != ARPHRD_ETHER)
473 goto out; 477 goto out;
474 478
475 /* if receive ARP during middle of NAPI poll, then queue */ 479 /* check if netpoll clients need ARP */
476 if (skb->protocol == htons(ETH_P_ARP) && 480 if (skb->protocol == htons(ETH_P_ARP) &&
477 atomic_read(&trapped)) { 481 atomic_read(&trapped)) {
478 skb_queue_tail(&npi->arp_tx, skb); 482 skb_queue_tail(&npi->arp_tx, skb);
@@ -534,9 +538,6 @@ int __netpoll_rx(struct sk_buff *skb)
534 return 1; 538 return 1;
535 539
536out: 540out:
537 /* If packet received while already in poll then just
538 * silently drop.
539 */
540 if (atomic_read(&trapped)) { 541 if (atomic_read(&trapped)) {
541 kfree_skb(skb); 542 kfree_skb(skb);
542 return 1; 543 return 1;
@@ -675,6 +676,7 @@ int netpoll_setup(struct netpoll *np)
675 goto release; 676 goto release;
676 } 677 }
677 678
679 npinfo->rx_flags = 0;
678 npinfo->rx_np = NULL; 680 npinfo->rx_np = NULL;
679 681
680 spin_lock_init(&npinfo->rx_lock); 682 spin_lock_init(&npinfo->rx_lock);
@@ -756,6 +758,7 @@ int netpoll_setup(struct netpoll *np)
756 758
757 if (np->rx_hook) { 759 if (np->rx_hook) {
758 spin_lock_irqsave(&npinfo->rx_lock, flags); 760 spin_lock_irqsave(&npinfo->rx_lock, flags);
761 npinfo->rx_flags |= NETPOLL_RX_ENABLED;
759 npinfo->rx_np = np; 762 npinfo->rx_np = np;
760 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 763 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
761 } 764 }
@@ -797,6 +800,7 @@ void netpoll_cleanup(struct netpoll *np)
797 if (npinfo->rx_np == np) { 800 if (npinfo->rx_np == np) {
798 spin_lock_irqsave(&npinfo->rx_lock, flags); 801 spin_lock_irqsave(&npinfo->rx_lock, flags);
799 npinfo->rx_np = NULL; 802 npinfo->rx_np = NULL;
803 npinfo->rx_flags &= ~NETPOLL_RX_ENABLED;
800 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 804 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
801 } 805 }
802 806
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index bfcdfaebca5c..20e63b302ba6 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3570,14 +3570,14 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3570 if (err) 3570 if (err)
3571 goto out1; 3571 goto out1;
3572 3572
3573 pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir); 3573 pkt_dev->entry = proc_create(ifname, 0600,
3574 pg_proc_dir, &pktgen_if_fops);
3574 if (!pkt_dev->entry) { 3575 if (!pkt_dev->entry) {
3575 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", 3576 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
3576 PG_PROC_DIR, ifname); 3577 PG_PROC_DIR, ifname);
3577 err = -EINVAL; 3578 err = -EINVAL;
3578 goto out2; 3579 goto out2;
3579 } 3580 }
3580 pkt_dev->entry->proc_fops = &pktgen_if_fops;
3581 pkt_dev->entry->data = pkt_dev; 3581 pkt_dev->entry->data = pkt_dev;
3582#ifdef CONFIG_XFRM 3582#ifdef CONFIG_XFRM
3583 pkt_dev->ipsmode = XFRM_MODE_TRANSPORT; 3583 pkt_dev->ipsmode = XFRM_MODE_TRANSPORT;
@@ -3628,7 +3628,7 @@ static int __init pktgen_create_thread(int cpu)
3628 kthread_bind(p, cpu); 3628 kthread_bind(p, cpu);
3629 t->tsk = p; 3629 t->tsk = p;
3630 3630
3631 pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir); 3631 pe = proc_create(t->tsk->comm, 0600, pg_proc_dir, &pktgen_thread_fops);
3632 if (!pe) { 3632 if (!pe) {
3633 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", 3633 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
3634 PG_PROC_DIR, t->tsk->comm); 3634 PG_PROC_DIR, t->tsk->comm);
@@ -3638,7 +3638,6 @@ static int __init pktgen_create_thread(int cpu)
3638 return -EINVAL; 3638 return -EINVAL;
3639 } 3639 }
3640 3640
3641 pe->proc_fops = &pktgen_thread_fops;
3642 pe->data = t; 3641 pe->data = t;
3643 3642
3644 wake_up_process(p); 3643 wake_up_process(p);
@@ -3709,7 +3708,7 @@ static int __init pg_init(void)
3709 return -ENODEV; 3708 return -ENODEV;
3710 pg_proc_dir->owner = THIS_MODULE; 3709 pg_proc_dir->owner = THIS_MODULE;
3711 3710
3712 pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir); 3711 pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops);
3713 if (pe == NULL) { 3712 if (pe == NULL) {
3714 printk(KERN_ERR "pktgen: ERROR: cannot create %s " 3713 printk(KERN_ERR "pktgen: ERROR: cannot create %s "
3715 "procfs entry.\n", PGCTRL); 3714 "procfs entry.\n", PGCTRL);
@@ -3717,7 +3716,6 @@ static int __init pg_init(void)
3717 return -EINVAL; 3716 return -EINVAL;
3718 } 3717 }
3719 3718
3720 pe->proc_fops = &pktgen_fops;
3721 pe->data = NULL; 3719 pe->data = NULL;
3722 3720
3723 /* Register us to receive netdevice events */ 3721 /* Register us to receive netdevice events */
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 19880b086e71..9c7e5ffb223d 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -343,7 +343,7 @@ config INET_ESP
343 tristate "IP: ESP transformation" 343 tristate "IP: ESP transformation"
344 select XFRM 344 select XFRM
345 select CRYPTO 345 select CRYPTO
346 select CRYPTO_AEAD 346 select CRYPTO_AUTHENC
347 select CRYPTO_HMAC 347 select CRYPTO_HMAC
348 select CRYPTO_MD5 348 select CRYPTO_MD5
349 select CRYPTO_CBC 349 select CRYPTO_CBC
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index f282b26f63eb..87490f7bb0f7 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -752,6 +752,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
752 inet_del_ifa(in_dev, ifap, 0); 752 inet_del_ifa(in_dev, ifap, 0);
753 ifa->ifa_broadcast = 0; 753 ifa->ifa_broadcast = 0;
754 ifa->ifa_anycast = 0; 754 ifa->ifa_anycast = 0;
755 ifa->ifa_scope = 0;
755 } 756 }
756 757
757 ifa->ifa_address = ifa->ifa_local = sin->sin_addr.s_addr; 758 ifa->ifa_address = ifa->ifa_local = sin->sin_addr.s_addr;
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 906cb1ada4c3..e7821ba7a9a0 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -266,20 +266,24 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
266 if (!dev) 266 if (!dev)
267 return NULL; 267 return NULL;
268 268
269 if (strchr(name, '%')) {
270 if (dev_alloc_name(dev, name) < 0)
271 goto failed_free;
272 }
273
269 dev->init = ipgre_tunnel_init; 274 dev->init = ipgre_tunnel_init;
270 nt = netdev_priv(dev); 275 nt = netdev_priv(dev);
271 nt->parms = *parms; 276 nt->parms = *parms;
272 277
273 if (register_netdevice(dev) < 0) { 278 if (register_netdevice(dev) < 0)
274 free_netdev(dev); 279 goto failed_free;
275 goto failed;
276 }
277 280
278 dev_hold(dev); 281 dev_hold(dev);
279 ipgre_tunnel_link(nt); 282 ipgre_tunnel_link(nt);
280 return nt; 283 return nt;
281 284
282failed: 285failed_free:
286 free_netdev(dev);
283 return NULL; 287 return NULL;
284} 288}
285 289
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index ae1f45fc23b9..58b60b2fb011 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -108,8 +108,11 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
108 const int cpu = get_cpu(); 108 const int cpu = get_cpu();
109 u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu); 109 u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu);
110 struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu); 110 struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu);
111 int err = crypto_comp_compress(tfm, start, plen, scratch, &dlen); 111 int err;
112 112
113 local_bh_disable();
114 err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
115 local_bh_enable();
113 if (err) 116 if (err)
114 goto out; 117 goto out;
115 118
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 10013ccee8dd..5dd938579eeb 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -753,9 +753,9 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d
753 printk("Unknown ARP type 0x%04x for device %s\n", dev->type, dev->name); 753 printk("Unknown ARP type 0x%04x for device %s\n", dev->type, dev->name);
754 b->htype = dev->type; /* can cause undefined behavior */ 754 b->htype = dev->type; /* can cause undefined behavior */
755 } 755 }
756
757 /* server_ip and your_ip address are both already zero per RFC2131 */
756 b->hlen = dev->addr_len; 758 b->hlen = dev->addr_len;
757 b->your_ip = NONE;
758 b->server_ip = NONE;
759 memcpy(b->hw_addr, dev->dev_addr, dev->addr_len); 759 memcpy(b->hw_addr, dev->dev_addr, dev->addr_len);
760 b->secs = htons(jiffies_diff / HZ); 760 b->secs = htons(jiffies_diff / HZ);
761 b->xid = d->xid; 761 b->xid = d->xid;
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index e77e3b855834..dbaed69de06a 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -228,20 +228,24 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c
228 if (dev == NULL) 228 if (dev == NULL)
229 return NULL; 229 return NULL;
230 230
231 if (strchr(name, '%')) {
232 if (dev_alloc_name(dev, name) < 0)
233 goto failed_free;
234 }
235
231 nt = netdev_priv(dev); 236 nt = netdev_priv(dev);
232 dev->init = ipip_tunnel_init; 237 dev->init = ipip_tunnel_init;
233 nt->parms = *parms; 238 nt->parms = *parms;
234 239
235 if (register_netdevice(dev) < 0) { 240 if (register_netdevice(dev) < 0)
236 free_netdev(dev); 241 goto failed_free;
237 goto failed;
238 }
239 242
240 dev_hold(dev); 243 dev_hold(dev);
241 ipip_tunnel_link(nt); 244 ipip_tunnel_link(nt);
242 return nt; 245 return nt;
243 246
244failed: 247failed_free:
248 free_netdev(dev);
245 return NULL; 249 return NULL;
246} 250}
247 251
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 525787b52b72..7b5e8e1d94be 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -542,12 +542,11 @@ static __init int ip_rt_proc_init(struct net *net)
542 if (!pde) 542 if (!pde)
543 goto err1; 543 goto err1;
544 544
545 pde = create_proc_entry("rt_cache", S_IRUGO, net->proc_net_stat); 545 pde = proc_create("rt_cache", S_IRUGO,
546 net->proc_net_stat, &rt_cpu_seq_fops);
546 if (!pde) 547 if (!pde)
547 goto err2; 548 goto err2;
548 549
549 pde->proc_fops = &rt_cpu_seq_fops;
550
551#ifdef CONFIG_NET_CLS_ROUTE 550#ifdef CONFIG_NET_CLS_ROUTE
552 pde = create_proc_read_entry("rt_acct", 0, net->proc_net, 551 pde = create_proc_read_entry("rt_acct", 0, net->proc_net,
553 ip_rt_acct_read, NULL); 552 ip_rt_acct_read, NULL);
diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c
index 5212ed9b0c98..7eb7636db0d0 100644
--- a/net/ipv4/tcp_bic.c
+++ b/net/ipv4/tcp_bic.c
@@ -1,12 +1,13 @@
1/* 1/*
2 * Binary Increase Congestion control for TCP 2 * Binary Increase Congestion control for TCP
3 * 3 * Home page:
4 * http://netsrv.csc.ncsu.edu/twiki/bin/view/Main/BIC
4 * This is from the implementation of BICTCP in 5 * This is from the implementation of BICTCP in
5 * Lison-Xu, Kahaled Harfoush, and Injong Rhee. 6 * Lison-Xu, Kahaled Harfoush, and Injong Rhee.
6 * "Binary Increase Congestion Control for Fast, Long Distance 7 * "Binary Increase Congestion Control for Fast, Long Distance
7 * Networks" in InfoComm 2004 8 * Networks" in InfoComm 2004
8 * Available from: 9 * Available from:
9 * http://www.csc.ncsu.edu/faculty/rhee/export/bitcp.pdf 10 * http://netsrv.csc.ncsu.edu/export/bitcp.pdf
10 * 11 *
11 * Unless BIC is enabled and congestion window is large 12 * Unless BIC is enabled and congestion window is large
12 * this behaves the same as the original Reno. 13 * this behaves the same as the original Reno.
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 19c449f62672..7facdb0f6960 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1367,7 +1367,7 @@ static struct sk_buff *tcp_sacktag_walk(struct sk_buff *skb, struct sock *sk,
1367 * a normal way 1367 * a normal way
1368 */ 1368 */
1369static struct sk_buff *tcp_sacktag_skip(struct sk_buff *skb, struct sock *sk, 1369static struct sk_buff *tcp_sacktag_skip(struct sk_buff *skb, struct sock *sk,
1370 u32 skip_to_seq) 1370 u32 skip_to_seq, int *fack_count)
1371{ 1371{
1372 tcp_for_write_queue_from(skb, sk) { 1372 tcp_for_write_queue_from(skb, sk) {
1373 if (skb == tcp_send_head(sk)) 1373 if (skb == tcp_send_head(sk))
@@ -1375,6 +1375,8 @@ static struct sk_buff *tcp_sacktag_skip(struct sk_buff *skb, struct sock *sk,
1375 1375
1376 if (!before(TCP_SKB_CB(skb)->end_seq, skip_to_seq)) 1376 if (!before(TCP_SKB_CB(skb)->end_seq, skip_to_seq))
1377 break; 1377 break;
1378
1379 *fack_count += tcp_skb_pcount(skb);
1378 } 1380 }
1379 return skb; 1381 return skb;
1380} 1382}
@@ -1390,7 +1392,7 @@ static struct sk_buff *tcp_maybe_skipping_dsack(struct sk_buff *skb,
1390 return skb; 1392 return skb;
1391 1393
1392 if (before(next_dup->start_seq, skip_to_seq)) { 1394 if (before(next_dup->start_seq, skip_to_seq)) {
1393 skb = tcp_sacktag_skip(skb, sk, next_dup->start_seq); 1395 skb = tcp_sacktag_skip(skb, sk, next_dup->start_seq, fack_count);
1394 tcp_sacktag_walk(skb, sk, NULL, 1396 tcp_sacktag_walk(skb, sk, NULL,
1395 next_dup->start_seq, next_dup->end_seq, 1397 next_dup->start_seq, next_dup->end_seq,
1396 1, fack_count, reord, flag); 1398 1, fack_count, reord, flag);
@@ -1537,7 +1539,8 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb,
1537 1539
1538 /* Head todo? */ 1540 /* Head todo? */
1539 if (before(start_seq, cache->start_seq)) { 1541 if (before(start_seq, cache->start_seq)) {
1540 skb = tcp_sacktag_skip(skb, sk, start_seq); 1542 skb = tcp_sacktag_skip(skb, sk, start_seq,
1543 &fack_count);
1541 skb = tcp_sacktag_walk(skb, sk, next_dup, 1544 skb = tcp_sacktag_walk(skb, sk, next_dup,
1542 start_seq, 1545 start_seq,
1543 cache->start_seq, 1546 cache->start_seq,
@@ -1565,7 +1568,8 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb,
1565 goto walk; 1568 goto walk;
1566 } 1569 }
1567 1570
1568 skb = tcp_sacktag_skip(skb, sk, cache->end_seq); 1571 skb = tcp_sacktag_skip(skb, sk, cache->end_seq,
1572 &fack_count);
1569 /* Check overlap against next cached too (past this one already) */ 1573 /* Check overlap against next cached too (past this one already) */
1570 cache++; 1574 cache++;
1571 continue; 1575 continue;
@@ -1577,7 +1581,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb,
1577 break; 1581 break;
1578 fack_count = tp->fackets_out; 1582 fack_count = tp->fackets_out;
1579 } 1583 }
1580 skb = tcp_sacktag_skip(skb, sk, start_seq); 1584 skb = tcp_sacktag_skip(skb, sk, start_seq, &fack_count);
1581 1585
1582walk: 1586walk:
1583 skb = tcp_sacktag_walk(skb, sk, next_dup, start_seq, end_seq, 1587 skb = tcp_sacktag_walk(skb, sk, next_dup, start_seq, end_seq,
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index ed750f9ceb07..01578f544ad6 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1035,6 +1035,13 @@ static void tcp_cwnd_validate(struct sock *sk)
1035 * introducing MSS oddities to segment boundaries. In rare cases where 1035 * introducing MSS oddities to segment boundaries. In rare cases where
1036 * mss_now != mss_cache, we will request caller to create a small skb 1036 * mss_now != mss_cache, we will request caller to create a small skb
1037 * per input skb which could be mostly avoided here (if desired). 1037 * per input skb which could be mostly avoided here (if desired).
1038 *
1039 * We explicitly want to create a request for splitting write queue tail
1040 * to a small skb for Nagle purposes while avoiding unnecessary modulos,
1041 * thus all the complexity (cwnd_len is always MSS multiple which we
1042 * return whenever allowed by the other factors). Basically we need the
1043 * modulo only when the receiver window alone is the limiting factor or
1044 * when we would be allowed to send the split-due-to-Nagle skb fully.
1038 */ 1045 */
1039static unsigned int tcp_mss_split_point(struct sock *sk, struct sk_buff *skb, 1046static unsigned int tcp_mss_split_point(struct sock *sk, struct sk_buff *skb,
1040 unsigned int mss_now, unsigned int cwnd) 1047 unsigned int mss_now, unsigned int cwnd)
@@ -1048,10 +1055,11 @@ static unsigned int tcp_mss_split_point(struct sock *sk, struct sk_buff *skb,
1048 if (likely(cwnd_len <= window && skb != tcp_write_queue_tail(sk))) 1055 if (likely(cwnd_len <= window && skb != tcp_write_queue_tail(sk)))
1049 return cwnd_len; 1056 return cwnd_len;
1050 1057
1051 if (skb == tcp_write_queue_tail(sk) && cwnd_len <= skb->len) 1058 needed = min(skb->len, window);
1059
1060 if (skb == tcp_write_queue_tail(sk) && cwnd_len <= needed)
1052 return cwnd_len; 1061 return cwnd_len;
1053 1062
1054 needed = min(skb->len, window);
1055 return needed - needed % mss_now; 1063 return needed - needed % mss_now;
1056} 1064}
1057 1065
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index 3ffb0323668c..58219dfffef8 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -85,7 +85,7 @@ config INET6_ESP
85 depends on IPV6 85 depends on IPV6
86 select XFRM 86 select XFRM
87 select CRYPTO 87 select CRYPTO
88 select CRYPTO_AEAD 88 select CRYPTO_AUTHENC
89 select CRYPTO_HMAC 89 select CRYPTO_HMAC
90 select CRYPTO_MD5 90 select CRYPTO_MD5
91 select CRYPTO_CBC 91 select CRYPTO_CBC
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e40213db9e4c..101e0e70ba27 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1557,6 +1557,7 @@ addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev,
1557 .fc_expires = expires, 1557 .fc_expires = expires,
1558 .fc_dst_len = plen, 1558 .fc_dst_len = plen,
1559 .fc_flags = RTF_UP | flags, 1559 .fc_flags = RTF_UP | flags,
1560 .fc_nlinfo.nl_net = &init_net,
1560 }; 1561 };
1561 1562
1562 ipv6_addr_copy(&cfg.fc_dst, pfx); 1563 ipv6_addr_copy(&cfg.fc_dst, pfx);
@@ -1583,6 +1584,7 @@ static void addrconf_add_mroute(struct net_device *dev)
1583 .fc_ifindex = dev->ifindex, 1584 .fc_ifindex = dev->ifindex,
1584 .fc_dst_len = 8, 1585 .fc_dst_len = 8,
1585 .fc_flags = RTF_UP, 1586 .fc_flags = RTF_UP,
1587 .fc_nlinfo.nl_net = &init_net,
1586 }; 1588 };
1587 1589
1588 ipv6_addr_set(&cfg.fc_dst, htonl(0xFF000000), 0, 0, 0); 1590 ipv6_addr_set(&cfg.fc_dst, htonl(0xFF000000), 0, 0, 0);
@@ -1599,6 +1601,7 @@ static void sit_route_add(struct net_device *dev)
1599 .fc_ifindex = dev->ifindex, 1601 .fc_ifindex = dev->ifindex,
1600 .fc_dst_len = 96, 1602 .fc_dst_len = 96,
1601 .fc_flags = RTF_UP | RTF_NONEXTHOP, 1603 .fc_flags = RTF_UP | RTF_NONEXTHOP,
1604 .fc_nlinfo.nl_net = &init_net,
1602 }; 1605 };
1603 1606
1604 /* prefix length - 96 bits "::d.d.d.d" */ 1607 /* prefix length - 96 bits "::d.d.d.d" */
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 2a124e9a1b2d..78f438880923 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -238,17 +238,24 @@ static struct ip6_tnl *ip6_tnl_create(struct ip6_tnl_parm *p)
238 if (dev == NULL) 238 if (dev == NULL)
239 goto failed; 239 goto failed;
240 240
241 if (strchr(name, '%')) {
242 if (dev_alloc_name(dev, name) < 0)
243 goto failed_free;
244 }
245
241 t = netdev_priv(dev); 246 t = netdev_priv(dev);
242 dev->init = ip6_tnl_dev_init; 247 dev->init = ip6_tnl_dev_init;
243 t->parms = *p; 248 t->parms = *p;
244 249
245 if ((err = register_netdevice(dev)) < 0) { 250 if ((err = register_netdevice(dev)) < 0)
246 free_netdev(dev); 251 goto failed_free;
247 goto failed; 252
248 }
249 dev_hold(dev); 253 dev_hold(dev);
250 ip6_tnl_link(t); 254 ip6_tnl_link(t);
251 return t; 255 return t;
256
257failed_free:
258 free_netdev(dev);
252failed: 259failed:
253 return NULL; 260 return NULL;
254} 261}
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index b90039593a7f..e3dcfa2f436b 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -146,7 +146,9 @@ static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb)
146 scratch = *per_cpu_ptr(ipcomp6_scratches, cpu); 146 scratch = *per_cpu_ptr(ipcomp6_scratches, cpu);
147 tfm = *per_cpu_ptr(ipcd->tfms, cpu); 147 tfm = *per_cpu_ptr(ipcd->tfms, cpu);
148 148
149 local_bh_disable();
149 err = crypto_comp_compress(tfm, start, plen, scratch, &dlen); 150 err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
151 local_bh_enable();
150 if (err || (dlen + sizeof(*ipch)) >= plen) { 152 if (err || (dlen + sizeof(*ipch)) >= plen) {
151 put_cpu(); 153 put_cpu();
152 goto out_ok; 154 goto out_ok;
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 35e502a72495..199ef379e501 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -217,12 +217,12 @@ int snmp6_register_dev(struct inet6_dev *idev)
217 if (!proc_net_devsnmp6) 217 if (!proc_net_devsnmp6)
218 return -ENOENT; 218 return -ENOENT;
219 219
220 p = create_proc_entry(idev->dev->name, S_IRUGO, proc_net_devsnmp6); 220 p = proc_create(idev->dev->name, S_IRUGO,
221 proc_net_devsnmp6, &snmp6_seq_fops);
221 if (!p) 222 if (!p)
222 return -ENOMEM; 223 return -ENOMEM;
223 224
224 p->data = idev; 225 p->data = idev;
225 p->proc_fops = &snmp6_seq_fops;
226 226
227 idev->stats.proc_dir_entry = p; 227 idev->stats.proc_dir_entry = p;
228 return 0; 228 return 0;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6e7b56ef4449..e8b241cb60bc 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1719,6 +1719,8 @@ static void rtmsg_to_fib6_config(struct in6_rtmsg *rtmsg,
1719 cfg->fc_src_len = rtmsg->rtmsg_src_len; 1719 cfg->fc_src_len = rtmsg->rtmsg_src_len;
1720 cfg->fc_flags = rtmsg->rtmsg_flags; 1720 cfg->fc_flags = rtmsg->rtmsg_flags;
1721 1721
1722 cfg->fc_nlinfo.nl_net = &init_net;
1723
1722 ipv6_addr_copy(&cfg->fc_dst, &rtmsg->rtmsg_dst); 1724 ipv6_addr_copy(&cfg->fc_dst, &rtmsg->rtmsg_dst);
1723 ipv6_addr_copy(&cfg->fc_src, &rtmsg->rtmsg_src); 1725 ipv6_addr_copy(&cfg->fc_src, &rtmsg->rtmsg_src);
1724 ipv6_addr_copy(&cfg->fc_gateway, &rtmsg->rtmsg_gateway); 1726 ipv6_addr_copy(&cfg->fc_gateway, &rtmsg->rtmsg_gateway);
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index dde7801abeff..1656c003b989 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -171,6 +171,11 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
171 if (dev == NULL) 171 if (dev == NULL)
172 return NULL; 172 return NULL;
173 173
174 if (strchr(name, '%')) {
175 if (dev_alloc_name(dev, name) < 0)
176 goto failed_free;
177 }
178
174 nt = netdev_priv(dev); 179 nt = netdev_priv(dev);
175 dev->init = ipip6_tunnel_init; 180 dev->init = ipip6_tunnel_init;
176 nt->parms = *parms; 181 nt->parms = *parms;
@@ -178,16 +183,16 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
178 if (parms->i_flags & SIT_ISATAP) 183 if (parms->i_flags & SIT_ISATAP)
179 dev->priv_flags |= IFF_ISATAP; 184 dev->priv_flags |= IFF_ISATAP;
180 185
181 if (register_netdevice(dev) < 0) { 186 if (register_netdevice(dev) < 0)
182 free_netdev(dev); 187 goto failed_free;
183 goto failed;
184 }
185 188
186 dev_hold(dev); 189 dev_hold(dev);
187 190
188 ipip6_tunnel_link(nt); 191 ipip6_tunnel_link(nt);
189 return nt; 192 return nt;
190 193
194failed_free:
195 free_netdev(dev);
191failed: 196failed:
192 return NULL; 197 return NULL;
193} 198}
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 408691b777c2..d6d3e68086f8 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -102,9 +102,6 @@ static int ipv6_sysctl_net_init(struct net *net)
102 net->ipv6.sysctl.table = register_net_sysctl_table(net, net_ipv6_ctl_path, 102 net->ipv6.sysctl.table = register_net_sysctl_table(net, net_ipv6_ctl_path,
103 ipv6_table); 103 ipv6_table);
104 if (!net->ipv6.sysctl.table) 104 if (!net->ipv6.sysctl.table)
105 return -ENOMEM;
106
107 if (!net->ipv6.sysctl.table)
108 goto out_ipv6_icmp_table; 105 goto out_ipv6_icmp_table;
109 106
110 err = 0; 107 err = 0;
diff --git a/net/ipx/ipx_proc.c b/net/ipx/ipx_proc.c
index d483a00dc427..5ed97ad0e2e3 100644
--- a/net/ipx/ipx_proc.c
+++ b/net/ipx/ipx_proc.c
@@ -358,22 +358,19 @@ int __init ipx_proc_init(void)
358 358
359 if (!ipx_proc_dir) 359 if (!ipx_proc_dir)
360 goto out; 360 goto out;
361 p = create_proc_entry("interface", S_IRUGO, ipx_proc_dir); 361 p = proc_create("interface", S_IRUGO,
362 ipx_proc_dir, &ipx_seq_interface_fops);
362 if (!p) 363 if (!p)
363 goto out_interface; 364 goto out_interface;
364 365
365 p->proc_fops = &ipx_seq_interface_fops; 366 p = proc_create("route", S_IRUGO, ipx_proc_dir, &ipx_seq_route_fops);
366 p = create_proc_entry("route", S_IRUGO, ipx_proc_dir);
367 if (!p) 367 if (!p)
368 goto out_route; 368 goto out_route;
369 369
370 p->proc_fops = &ipx_seq_route_fops; 370 p = proc_create("socket", S_IRUGO, ipx_proc_dir, &ipx_seq_socket_fops);
371 p = create_proc_entry("socket", S_IRUGO, ipx_proc_dir);
372 if (!p) 371 if (!p)
373 goto out_socket; 372 goto out_socket;
374 373
375 p->proc_fops = &ipx_seq_socket_fops;
376
377 rc = 0; 374 rc = 0;
378out: 375out:
379 return rc; 376 return rc;
diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c
index b825399fc160..6eef1f2a7553 100644
--- a/net/irda/ircomm/ircomm_core.c
+++ b/net/irda/ircomm/ircomm_core.c
@@ -76,9 +76,11 @@ static int __init ircomm_init(void)
76 76
77#ifdef CONFIG_PROC_FS 77#ifdef CONFIG_PROC_FS
78 { struct proc_dir_entry *ent; 78 { struct proc_dir_entry *ent;
79 ent = create_proc_entry("ircomm", 0, proc_irda); 79 ent = proc_create("ircomm", 0, proc_irda, &ircomm_proc_fops);
80 if (ent) 80 if (!ent) {
81 ent->proc_fops = &ircomm_proc_fops; 81 printk(KERN_ERR "ircomm_init: can't create /proc entry!\n");
82 return -ENODEV;
83 }
82 } 84 }
83#endif /* CONFIG_PROC_FS */ 85#endif /* CONFIG_PROC_FS */
84 86
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index a4b56e25a917..1eb4bbcb1c9e 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
@@ -128,13 +128,11 @@ static int __init irlan_init(void)
128 128
129#ifdef CONFIG_PROC_FS 129#ifdef CONFIG_PROC_FS
130 { struct proc_dir_entry *proc; 130 { struct proc_dir_entry *proc;
131 proc = create_proc_entry("irlan", 0, proc_irda); 131 proc = proc_create("irlan", 0, proc_irda, &irlan_fops);
132 if (!proc) { 132 if (!proc) {
133 printk(KERN_ERR "irlan_init: can't create /proc entry!\n"); 133 printk(KERN_ERR "irlan_init: can't create /proc entry!\n");
134 return -ENODEV; 134 return -ENODEV;
135 } 135 }
136
137 proc->proc_fops = &irlan_fops;
138 } 136 }
139#endif /* CONFIG_PROC_FS */ 137#endif /* CONFIG_PROC_FS */
140 138
diff --git a/net/irda/irproc.c b/net/irda/irproc.c
index cae24fbda966..88e80a312732 100644
--- a/net/irda/irproc.c
+++ b/net/irda/irproc.c
@@ -72,11 +72,9 @@ void __init irda_proc_register(void)
72 return; 72 return;
73 proc_irda->owner = THIS_MODULE; 73 proc_irda->owner = THIS_MODULE;
74 74
75 for (i=0; i<ARRAY_SIZE(irda_dirs); i++) { 75 for (i = 0; i < ARRAY_SIZE(irda_dirs); i++)
76 d = create_proc_entry(irda_dirs[i].name, 0, proc_irda); 76 d = proc_create(irda_dirs[i].name, 0, proc_irda,
77 if (d) 77 irda_dirs[i].fops);
78 d->proc_fops = irda_dirs[i].fops;
79 }
80} 78}
81 79
82/* 80/*
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 2753b0c448f3..d764f4c1b7e4 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -621,7 +621,6 @@ static int iucv_sever_pathid(u16 pathid, u8 userdata[16])
621 return iucv_call_b2f0(IUCV_SEVER, parm); 621 return iucv_call_b2f0(IUCV_SEVER, parm);
622} 622}
623 623
624#ifdef CONFIG_SMP
625/** 624/**
626 * __iucv_cleanup_queue 625 * __iucv_cleanup_queue
627 * @dummy: unused dummy argument 626 * @dummy: unused dummy argument
@@ -632,7 +631,6 @@ static int iucv_sever_pathid(u16 pathid, u8 userdata[16])
632static void __iucv_cleanup_queue(void *dummy) 631static void __iucv_cleanup_queue(void *dummy)
633{ 632{
634} 633}
635#endif
636 634
637/** 635/**
638 * iucv_cleanup_queue 636 * iucv_cleanup_queue
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 1c853927810a..8b5f486ac80f 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3807,17 +3807,16 @@ static int pfkey_init_proc(void)
3807{ 3807{
3808 struct proc_dir_entry *e; 3808 struct proc_dir_entry *e;
3809 3809
3810 e = create_proc_entry("pfkey", 0, init_net.proc_net); 3810 e = proc_net_fops_create(&init_net, "pfkey", 0, &pfkey_proc_ops);
3811 if (e == NULL) 3811 if (e == NULL)
3812 return -ENOMEM; 3812 return -ENOMEM;
3813 3813
3814 e->proc_fops = &pfkey_proc_ops;
3815 return 0; 3814 return 0;
3816} 3815}
3817 3816
3818static void pfkey_exit_proc(void) 3817static void pfkey_exit_proc(void)
3819{ 3818{
3820 remove_proc_entry("net/pfkey", NULL); 3819 proc_net_remove(&init_net, "pfkey");
3821} 3820}
3822#else 3821#else
3823static inline int pfkey_init_proc(void) 3822static inline int pfkey_init_proc(void)
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
index cb34bc0518e8..48212c0a961c 100644
--- a/net/llc/llc_proc.c
+++ b/net/llc/llc_proc.c
@@ -239,18 +239,14 @@ int __init llc_proc_init(void)
239 goto out; 239 goto out;
240 llc_proc_dir->owner = THIS_MODULE; 240 llc_proc_dir->owner = THIS_MODULE;
241 241
242 p = create_proc_entry("socket", S_IRUGO, llc_proc_dir); 242 p = proc_create("socket", S_IRUGO, llc_proc_dir, &llc_seq_socket_fops);
243 if (!p) 243 if (!p)
244 goto out_socket; 244 goto out_socket;
245 245
246 p->proc_fops = &llc_seq_socket_fops; 246 p = proc_create("core", S_IRUGO, llc_proc_dir, &llc_seq_core_fops);
247
248 p = create_proc_entry("core", S_IRUGO, llc_proc_dir);
249 if (!p) 247 if (!p)
250 goto out_core; 248 goto out_core;
251 249
252 p->proc_fops = &llc_seq_core_fops;
253
254 rc = 0; 250 rc = 0;
255out: 251out:
256 return rc; 252 return rc;
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 2019b4f0528d..9aeed5320228 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -1116,9 +1116,10 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
1116 /* prepare reordering buffer */ 1116 /* prepare reordering buffer */
1117 tid_agg_rx->reorder_buf = 1117 tid_agg_rx->reorder_buf =
1118 kmalloc(buf_size * sizeof(struct sk_buf *), GFP_ATOMIC); 1118 kmalloc(buf_size * sizeof(struct sk_buf *), GFP_ATOMIC);
1119 if ((!tid_agg_rx->reorder_buf) && net_ratelimit()) { 1119 if (!tid_agg_rx->reorder_buf) {
1120 printk(KERN_ERR "can not allocate reordering buffer " 1120 if (net_ratelimit())
1121 "to tid %d\n", tid); 1121 printk(KERN_ERR "can not allocate reordering buffer "
1122 "to tid %d\n", tid);
1122 goto end; 1123 goto end;
1123 } 1124 }
1124 memset(tid_agg_rx->reorder_buf, 0, 1125 memset(tid_agg_rx->reorder_buf, 0,
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index c339571632b2..3b77410588e7 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -2,7 +2,7 @@
2 * Copyright 2002-2005, Instant802 Networks, Inc. 2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005, Devicescape Software, Inc. 3 * Copyright 2005, Devicescape Software, Inc.
4 * Copyright 2007, Mattias Nissler <mattias.nissler@gmx.de> 4 * Copyright 2007, Mattias Nissler <mattias.nissler@gmx.de>
5 * Copyright 2007, Stefano Brivio <stefano.brivio@polimi.it> 5 * Copyright 2007-2008, Stefano Brivio <stefano.brivio@polimi.it>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -63,72 +63,66 @@
63 * RC_PID_ARITH_SHIFT. 63 * RC_PID_ARITH_SHIFT.
64 */ 64 */
65 65
66 66/* Adjust the rate while ensuring that we won't switch to a lower rate if it
67/* Shift the adjustment so that we won't switch to a lower rate if it exhibited 67 * exhibited a worse failed frames behaviour and we'll choose the highest rate
68 * a worse failed frames behaviour and we'll choose the highest rate whose 68 * whose failed frames behaviour is not worse than the one of the original rate
69 * failed frames behaviour is not worse than the one of the original rate 69 * target. While at it, check that the new rate is valid. */
70 * target. While at it, check that the adjustment is within the ranges. Then,
71 * provide the new rate index. */
72static int rate_control_pid_shift_adjust(struct rc_pid_rateinfo *r,
73 int adj, int cur, int l)
74{
75 int i, j, k, tmp;
76
77 j = r[cur].rev_index;
78 i = j + adj;
79
80 if (i < 0)
81 return r[0].index;
82 if (i >= l - 1)
83 return r[l - 1].index;
84
85 tmp = i;
86
87 if (adj < 0) {
88 for (k = j; k >= i; k--)
89 if (r[k].diff <= r[j].diff)
90 tmp = k;
91 } else {
92 for (k = i + 1; k + i < l; k++)
93 if (r[k].diff <= r[i].diff)
94 tmp = k;
95 }
96
97 return r[tmp].index;
98}
99
100static void rate_control_pid_adjust_rate(struct ieee80211_local *local, 70static void rate_control_pid_adjust_rate(struct ieee80211_local *local,
101 struct sta_info *sta, int adj, 71 struct sta_info *sta, int adj,
102 struct rc_pid_rateinfo *rinfo) 72 struct rc_pid_rateinfo *rinfo)
103{ 73{
104 struct ieee80211_sub_if_data *sdata; 74 struct ieee80211_sub_if_data *sdata;
105 struct ieee80211_hw_mode *mode; 75 struct ieee80211_hw_mode *mode;
106 int newidx; 76 int cur_sorted, new_sorted, probe, tmp, n_bitrates;
107 int maxrate; 77 int cur = sta->txrate;
108 int back = (adj > 0) ? 1 : -1;
109 78
110 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); 79 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
111 80
112 mode = local->oper_hw_mode; 81 mode = local->oper_hw_mode;
113 maxrate = sdata->bss ? sdata->bss->max_ratectrl_rateidx : -1; 82 n_bitrates = mode->num_rates;
114 83
115 newidx = rate_control_pid_shift_adjust(rinfo, adj, sta->txrate, 84 /* Map passed arguments to sorted values. */
116 mode->num_rates); 85 cur_sorted = rinfo[cur].rev_index;
86 new_sorted = cur_sorted + adj;
117 87
118 while (newidx != sta->txrate) { 88 /* Check limits. */
119 if (rate_supported(sta, mode, newidx) && 89 if (new_sorted < 0)
120 (maxrate < 0 || newidx <= maxrate)) { 90 new_sorted = rinfo[0].rev_index;
121 sta->txrate = newidx; 91 else if (new_sorted >= n_bitrates)
122 break; 92 new_sorted = rinfo[n_bitrates - 1].rev_index;
123 }
124 93
125 newidx += back; 94 tmp = new_sorted;
95
96 if (adj < 0) {
97 /* Ensure that the rate decrease isn't disadvantageous. */
98 for (probe = cur_sorted; probe >= new_sorted; probe--)
99 if (rinfo[probe].diff <= rinfo[cur_sorted].diff &&
100 rate_supported(sta, mode, rinfo[probe].index))
101 tmp = probe;
102 } else {
103 /* Look for rate increase with zero (or below) cost. */
104 for (probe = new_sorted + 1; probe < n_bitrates; probe++)
105 if (rinfo[probe].diff <= rinfo[new_sorted].diff &&
106 rate_supported(sta, mode, rinfo[probe].index))
107 tmp = probe;
126 } 108 }
127 109
110 /* Fit the rate found to the nearest supported rate. */
111 do {
112 if (rate_supported(sta, mode, rinfo[tmp].index)) {
113 sta->txrate = rinfo[tmp].index;
114 break;
115 }
116 if (adj < 0)
117 tmp--;
118 else
119 tmp++;
120 } while (tmp < n_bitrates && tmp >= 0);
121
128#ifdef CONFIG_MAC80211_DEBUGFS 122#ifdef CONFIG_MAC80211_DEBUGFS
129 rate_control_pid_event_rate_change( 123 rate_control_pid_event_rate_change(
130 &((struct rc_pid_sta_info *)sta->rate_ctrl_priv)->events, 124 &((struct rc_pid_sta_info *)sta->rate_ctrl_priv)->events,
131 newidx, mode->rates[newidx].rate); 125 cur, mode->rates[cur].rate);
132#endif 126#endif
133} 127}
134 128
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 327e847d2702..b77eb56a87e3 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -256,13 +256,19 @@ __nf_conntrack_find(const struct nf_conntrack_tuple *tuple)
256 struct hlist_node *n; 256 struct hlist_node *n;
257 unsigned int hash = hash_conntrack(tuple); 257 unsigned int hash = hash_conntrack(tuple);
258 258
259 /* Disable BHs the entire time since we normally need to disable them
260 * at least once for the stats anyway.
261 */
262 local_bh_disable();
259 hlist_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash], hnode) { 263 hlist_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash], hnode) {
260 if (nf_ct_tuple_equal(tuple, &h->tuple)) { 264 if (nf_ct_tuple_equal(tuple, &h->tuple)) {
261 NF_CT_STAT_INC(found); 265 NF_CT_STAT_INC(found);
266 local_bh_enable();
262 return h; 267 return h;
263 } 268 }
264 NF_CT_STAT_INC(searched); 269 NF_CT_STAT_INC(searched);
265 } 270 }
271 local_bh_enable();
266 272
267 return NULL; 273 return NULL;
268} 274}
@@ -400,17 +406,20 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
400 struct hlist_node *n; 406 struct hlist_node *n;
401 unsigned int hash = hash_conntrack(tuple); 407 unsigned int hash = hash_conntrack(tuple);
402 408
403 rcu_read_lock(); 409 /* Disable BHs the entire time since we need to disable them at
410 * least once for the stats anyway.
411 */
412 rcu_read_lock_bh();
404 hlist_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash], hnode) { 413 hlist_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash], hnode) {
405 if (nf_ct_tuplehash_to_ctrack(h) != ignored_conntrack && 414 if (nf_ct_tuplehash_to_ctrack(h) != ignored_conntrack &&
406 nf_ct_tuple_equal(tuple, &h->tuple)) { 415 nf_ct_tuple_equal(tuple, &h->tuple)) {
407 NF_CT_STAT_INC(found); 416 NF_CT_STAT_INC(found);
408 rcu_read_unlock(); 417 rcu_read_unlock_bh();
409 return 1; 418 return 1;
410 } 419 }
411 NF_CT_STAT_INC(searched); 420 NF_CT_STAT_INC(searched);
412 } 421 }
413 rcu_read_unlock(); 422 rcu_read_unlock_bh();
414 423
415 return 0; 424 return 0;
416} 425}
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index e06bf0028bb1..684ec9c1ad38 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -381,7 +381,7 @@ int nf_ct_expect_related(struct nf_conntrack_expect *expect)
381 if (nf_ct_expect_count >= nf_ct_expect_max) { 381 if (nf_ct_expect_count >= nf_ct_expect_max) {
382 if (net_ratelimit()) 382 if (net_ratelimit())
383 printk(KERN_WARNING 383 printk(KERN_WARNING
384 "nf_conntrack: expectation table full"); 384 "nf_conntrack: expectation table full\n");
385 ret = -EMFILE; 385 ret = -EMFILE;
386 goto out; 386 goto out;
387 } 387 }
diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c
index 8b9be1e978cd..2bd9963b5b3e 100644
--- a/net/netfilter/nf_conntrack_extend.c
+++ b/net/netfilter/nf_conntrack_extend.c
@@ -19,14 +19,6 @@
19static struct nf_ct_ext_type *nf_ct_ext_types[NF_CT_EXT_NUM]; 19static struct nf_ct_ext_type *nf_ct_ext_types[NF_CT_EXT_NUM];
20static DEFINE_MUTEX(nf_ct_ext_type_mutex); 20static DEFINE_MUTEX(nf_ct_ext_type_mutex);
21 21
22/* Horrible trick to figure out smallest amount worth kmallocing. */
23#define CACHE(x) (x) + 0 *
24enum {
25 NF_CT_EXT_MIN_SIZE =
26#include <linux/kmalloc_sizes.h>
27 1 };
28#undef CACHE
29
30void __nf_ct_ext_destroy(struct nf_conn *ct) 22void __nf_ct_ext_destroy(struct nf_conn *ct)
31{ 23{
32 unsigned int i; 24 unsigned int i;
@@ -53,7 +45,7 @@ EXPORT_SYMBOL(__nf_ct_ext_destroy);
53static void * 45static void *
54nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp) 46nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp)
55{ 47{
56 unsigned int off, len, real_len; 48 unsigned int off, len;
57 struct nf_ct_ext_type *t; 49 struct nf_ct_ext_type *t;
58 50
59 rcu_read_lock(); 51 rcu_read_lock();
@@ -61,16 +53,14 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp)
61 BUG_ON(t == NULL); 53 BUG_ON(t == NULL);
62 off = ALIGN(sizeof(struct nf_ct_ext), t->align); 54 off = ALIGN(sizeof(struct nf_ct_ext), t->align);
63 len = off + t->len; 55 len = off + t->len;
64 real_len = t->alloc_size;
65 rcu_read_unlock(); 56 rcu_read_unlock();
66 57
67 *ext = kzalloc(real_len, gfp); 58 *ext = kzalloc(t->alloc_size, gfp);
68 if (!*ext) 59 if (!*ext)
69 return NULL; 60 return NULL;
70 61
71 (*ext)->offset[id] = off; 62 (*ext)->offset[id] = off;
72 (*ext)->len = len; 63 (*ext)->len = len;
73 (*ext)->real_len = real_len;
74 64
75 return (void *)(*ext) + off; 65 return (void *)(*ext) + off;
76} 66}
@@ -95,7 +85,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
95 newlen = newoff + t->len; 85 newlen = newoff + t->len;
96 rcu_read_unlock(); 86 rcu_read_unlock();
97 87
98 if (newlen >= ct->ext->real_len) { 88 if (newlen >= ksize(ct->ext)) {
99 new = kmalloc(newlen, gfp); 89 new = kmalloc(newlen, gfp);
100 if (!new) 90 if (!new)
101 return NULL; 91 return NULL;
@@ -114,7 +104,6 @@ void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
114 rcu_read_unlock(); 104 rcu_read_unlock();
115 } 105 }
116 kfree(ct->ext); 106 kfree(ct->ext);
117 new->real_len = newlen;
118 ct->ext = new; 107 ct->ext = new;
119 } 108 }
120 109
@@ -156,8 +145,6 @@ static void update_alloc_size(struct nf_ct_ext_type *type)
156 t1->alloc_size = ALIGN(t1->alloc_size, t2->align) 145 t1->alloc_size = ALIGN(t1->alloc_size, t2->align)
157 + t2->len; 146 + t2->len;
158 } 147 }
159 if (t1->alloc_size < NF_CT_EXT_MIN_SIZE)
160 t1->alloc_size = NF_CT_EXT_MIN_SIZE;
161 } 148 }
162} 149}
163 150
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index bfc2928c1912..ddc80ea114cd 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -51,7 +51,7 @@ int nf_unregister_queue_handler(int pf, const struct nf_queue_handler *qh)
51 return -EINVAL; 51 return -EINVAL;
52 52
53 mutex_lock(&queue_handler_mutex); 53 mutex_lock(&queue_handler_mutex);
54 if (queue_handler[pf] != qh) { 54 if (queue_handler[pf] && queue_handler[pf] != qh) {
55 mutex_unlock(&queue_handler_mutex); 55 mutex_unlock(&queue_handler_mutex);
56 return -EINVAL; 56 return -EINVAL;
57 } 57 }
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 7efa40d47393..bf3f19b21fe4 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -556,7 +556,7 @@ nfulnl_log_packet(unsigned int pf,
556 /* FIXME: do we want to make the size calculation conditional based on 556 /* FIXME: do we want to make the size calculation conditional based on
557 * what is actually present? way more branches and checks, but more 557 * what is actually present? way more branches and checks, but more
558 * memory efficient... */ 558 * memory efficient... */
559 size = NLMSG_ALIGN(sizeof(struct nfgenmsg)) 559 size = NLMSG_SPACE(sizeof(struct nfgenmsg))
560 + nla_total_size(sizeof(struct nfulnl_msg_packet_hdr)) 560 + nla_total_size(sizeof(struct nfulnl_msg_packet_hdr))
561 + nla_total_size(sizeof(u_int32_t)) /* ifindex */ 561 + nla_total_size(sizeof(u_int32_t)) /* ifindex */
562 + nla_total_size(sizeof(u_int32_t)) /* ifindex */ 562 + nla_total_size(sizeof(u_int32_t)) /* ifindex */
@@ -702,20 +702,30 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
702 struct nfgenmsg *nfmsg = NLMSG_DATA(nlh); 702 struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
703 u_int16_t group_num = ntohs(nfmsg->res_id); 703 u_int16_t group_num = ntohs(nfmsg->res_id);
704 struct nfulnl_instance *inst; 704 struct nfulnl_instance *inst;
705 struct nfulnl_msg_config_cmd *cmd = NULL;
705 int ret = 0; 706 int ret = 0;
706 707
708 if (nfula[NFULA_CFG_CMD]) {
709 u_int8_t pf = nfmsg->nfgen_family;
710 cmd = nla_data(nfula[NFULA_CFG_CMD]);
711
712 /* Commands without queue context */
713 switch (cmd->command) {
714 case NFULNL_CFG_CMD_PF_BIND:
715 return nf_log_register(pf, &nfulnl_logger);
716 case NFULNL_CFG_CMD_PF_UNBIND:
717 nf_log_unregister_pf(pf);
718 return 0;
719 }
720 }
721
707 inst = instance_lookup_get(group_num); 722 inst = instance_lookup_get(group_num);
708 if (inst && inst->peer_pid != NETLINK_CB(skb).pid) { 723 if (inst && inst->peer_pid != NETLINK_CB(skb).pid) {
709 ret = -EPERM; 724 ret = -EPERM;
710 goto out_put; 725 goto out_put;
711 } 726 }
712 727
713 if (nfula[NFULA_CFG_CMD]) { 728 if (cmd != NULL) {
714 u_int8_t pf = nfmsg->nfgen_family;
715 struct nfulnl_msg_config_cmd *cmd;
716
717 cmd = nla_data(nfula[NFULA_CFG_CMD]);
718
719 switch (cmd->command) { 729 switch (cmd->command) {
720 case NFULNL_CFG_CMD_BIND: 730 case NFULNL_CFG_CMD_BIND:
721 if (inst) { 731 if (inst) {
@@ -738,14 +748,6 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
738 748
739 instance_destroy(inst); 749 instance_destroy(inst);
740 goto out; 750 goto out;
741 case NFULNL_CFG_CMD_PF_BIND:
742 ret = nf_log_register(pf, &nfulnl_logger);
743 break;
744 case NFULNL_CFG_CMD_PF_UNBIND:
745 /* This is a bug and a feature. We cannot unregister
746 * other handlers, like nfnetlink_inst can */
747 nf_log_unregister_pf(pf);
748 break;
749 default: 751 default:
750 ret = -ENOTSUPP; 752 ret = -ENOTSUPP;
751 break; 753 break;
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 0043d3a9f87e..012cb6910820 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -224,7 +224,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
224 struct net_device *indev; 224 struct net_device *indev;
225 struct net_device *outdev; 225 struct net_device *outdev;
226 226
227 size = NLMSG_ALIGN(sizeof(struct nfgenmsg)) 227 size = NLMSG_SPACE(sizeof(struct nfgenmsg))
228 + nla_total_size(sizeof(struct nfqnl_msg_packet_hdr)) 228 + nla_total_size(sizeof(struct nfqnl_msg_packet_hdr))
229 + nla_total_size(sizeof(u_int32_t)) /* ifindex */ 229 + nla_total_size(sizeof(u_int32_t)) /* ifindex */
230 + nla_total_size(sizeof(u_int32_t)) /* ifindex */ 230 + nla_total_size(sizeof(u_int32_t)) /* ifindex */
@@ -703,19 +703,12 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
703 /* Commands without queue context - might sleep */ 703 /* Commands without queue context - might sleep */
704 switch (cmd->command) { 704 switch (cmd->command) {
705 case NFQNL_CFG_CMD_PF_BIND: 705 case NFQNL_CFG_CMD_PF_BIND:
706 ret = nf_register_queue_handler(ntohs(cmd->pf), 706 return nf_register_queue_handler(ntohs(cmd->pf),
707 &nfqh); 707 &nfqh);
708 break;
709 case NFQNL_CFG_CMD_PF_UNBIND: 708 case NFQNL_CFG_CMD_PF_UNBIND:
710 ret = nf_unregister_queue_handler(ntohs(cmd->pf), 709 return nf_unregister_queue_handler(ntohs(cmd->pf),
711 &nfqh); 710 &nfqh);
712 break;
713 default:
714 break;
715 } 711 }
716
717 if (ret < 0)
718 return ret;
719 } 712 }
720 713
721 rcu_read_lock(); 714 rcu_read_lock();
diff --git a/net/netfilter/xt_conntrack.c b/net/netfilter/xt_conntrack.c
index 85330856a29c..0c50b2894055 100644
--- a/net/netfilter/xt_conntrack.c
+++ b/net/netfilter/xt_conntrack.c
@@ -122,7 +122,7 @@ conntrack_addrcmp(const union nf_inet_addr *kaddr,
122 const union nf_inet_addr *umask, unsigned int l3proto) 122 const union nf_inet_addr *umask, unsigned int l3proto)
123{ 123{
124 if (l3proto == AF_INET) 124 if (l3proto == AF_INET)
125 return (kaddr->ip & umask->ip) == uaddr->ip; 125 return ((kaddr->ip ^ uaddr->ip) & umask->ip) == 0;
126 else if (l3proto == AF_INET6) 126 else if (l3proto == AF_INET6)
127 return ipv6_masked_addr_cmp(&kaddr->in6, &umask->in6, 127 return ipv6_masked_addr_cmp(&kaddr->in6, &umask->in6,
128 &uaddr->in6) == 0; 128 &uaddr->in6) == 0;
@@ -231,7 +231,7 @@ conntrack_mt(const struct sk_buff *skb, const struct net_device *in,
231 if (test_bit(IPS_DST_NAT_BIT, &ct->status)) 231 if (test_bit(IPS_DST_NAT_BIT, &ct->status))
232 statebit |= XT_CONNTRACK_STATE_DNAT; 232 statebit |= XT_CONNTRACK_STATE_DNAT;
233 } 233 }
234 if ((info->state_mask & statebit) ^ 234 if (!!(info->state_mask & statebit) ^
235 !(info->invert_flags & XT_CONNTRACK_STATE)) 235 !(info->invert_flags & XT_CONNTRACK_STATE))
236 return false; 236 return false;
237 } 237 }
diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c
index e9a8794bc3ab..9fa2e0824708 100644
--- a/net/netfilter/xt_time.c
+++ b/net/netfilter/xt_time.c
@@ -95,8 +95,11 @@ static inline void localtime_2(struct xtm *r, time_t time)
95 */ 95 */
96 r->dse = time / 86400; 96 r->dse = time / 86400;
97 97
98 /* 1970-01-01 (w=0) was a Thursday (4). */ 98 /*
99 r->weekday = (4 + r->dse) % 7; 99 * 1970-01-01 (w=0) was a Thursday (4).
100 * -1 and +1 map Sunday properly onto 7.
101 */
102 r->weekday = (4 + r->dse - 1) % 7 + 1;
100} 103}
101 104
102static void localtime_3(struct xtm *r, time_t time) 105static void localtime_3(struct xtm *r, time_t time)
diff --git a/net/rxrpc/ar-recvmsg.c b/net/rxrpc/ar-recvmsg.c
index f19121d4795b..a39bf97f8830 100644
--- a/net/rxrpc/ar-recvmsg.c
+++ b/net/rxrpc/ar-recvmsg.c
@@ -143,7 +143,8 @@ int rxrpc_recvmsg(struct kiocb *iocb, struct socket *sock,
143 /* copy the peer address and timestamp */ 143 /* copy the peer address and timestamp */
144 if (!continue_call) { 144 if (!continue_call) {
145 if (msg->msg_name && msg->msg_namelen > 0) 145 if (msg->msg_name && msg->msg_namelen > 0)
146 memcpy(&msg->msg_name, &call->conn->trans->peer->srx, 146 memcpy(msg->msg_name,
147 &call->conn->trans->peer->srx,
147 sizeof(call->conn->trans->peer->srx)); 148 sizeof(call->conn->trans->peer->srx));
148 sock_recv_timestamp(msg, &rx->sk, skb); 149 sock_recv_timestamp(msg, &rx->sk, skb);
149 } 150 }
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 8bb79f281774..675a5c3e68a6 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -838,11 +838,11 @@ int sctp_auth_set_key(struct sctp_endpoint *ep,
838 } 838 }
839 839
840 /* Create a new key data based on the info passed in */ 840 /* Create a new key data based on the info passed in */
841 key = sctp_auth_create_key(auth_key->sca_keylen, GFP_KERNEL); 841 key = sctp_auth_create_key(auth_key->sca_keylength, GFP_KERNEL);
842 if (!key) 842 if (!key)
843 goto nomem; 843 goto nomem;
844 844
845 memcpy(key->data, &auth_key->sca_key[0], auth_key->sca_keylen); 845 memcpy(key->data, &auth_key->sca_key[0], auth_key->sca_keylength);
846 846
847 /* If we are replacing, remove the old keys data from the 847 /* If we are replacing, remove the old keys data from the
848 * key id. If we are adding new key id, add it to the 848 * key id. If we are adding new key id, add it to the
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index a27511ebc4cb..ceefda025e2d 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -209,6 +209,7 @@ int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
209int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr) 209int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
210{ 210{
211 struct sctp_sockaddr_entry *addr, *temp; 211 struct sctp_sockaddr_entry *addr, *temp;
212 int found = 0;
212 213
213 /* We hold the socket lock when calling this function, 214 /* We hold the socket lock when calling this function,
214 * and that acts as a writer synchronizing lock. 215 * and that acts as a writer synchronizing lock.
@@ -216,13 +217,14 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
216 list_for_each_entry_safe(addr, temp, &bp->address_list, list) { 217 list_for_each_entry_safe(addr, temp, &bp->address_list, list) {
217 if (sctp_cmp_addr_exact(&addr->a, del_addr)) { 218 if (sctp_cmp_addr_exact(&addr->a, del_addr)) {
218 /* Found the exact match. */ 219 /* Found the exact match. */
220 found = 1;
219 addr->valid = 0; 221 addr->valid = 0;
220 list_del_rcu(&addr->list); 222 list_del_rcu(&addr->list);
221 break; 223 break;
222 } 224 }
223 } 225 }
224 226
225 if (addr && !addr->valid) { 227 if (found) {
226 call_rcu(&addr->rcu, sctp_local_addr_free); 228 call_rcu(&addr->rcu, sctp_local_addr_free);
227 SCTP_DBG_OBJCNT_DEC(addr); 229 SCTP_DBG_OBJCNT_DEC(addr);
228 return 0; 230 return 0;
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 4d7ec961ae1d..9aa0733aee87 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -89,6 +89,7 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev,
89 struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr; 89 struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr;
90 struct sctp_sockaddr_entry *addr = NULL; 90 struct sctp_sockaddr_entry *addr = NULL;
91 struct sctp_sockaddr_entry *temp; 91 struct sctp_sockaddr_entry *temp;
92 int found = 0;
92 93
93 switch (ev) { 94 switch (ev) {
94 case NETDEV_UP: 95 case NETDEV_UP:
@@ -111,13 +112,14 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev,
111 &sctp_local_addr_list, list) { 112 &sctp_local_addr_list, list) {
112 if (ipv6_addr_equal(&addr->a.v6.sin6_addr, 113 if (ipv6_addr_equal(&addr->a.v6.sin6_addr,
113 &ifa->addr)) { 114 &ifa->addr)) {
115 found = 1;
114 addr->valid = 0; 116 addr->valid = 0;
115 list_del_rcu(&addr->list); 117 list_del_rcu(&addr->list);
116 break; 118 break;
117 } 119 }
118 } 120 }
119 spin_unlock_bh(&sctp_local_addr_lock); 121 spin_unlock_bh(&sctp_local_addr_lock);
120 if (addr && !addr->valid) 122 if (found)
121 call_rcu(&addr->rcu, sctp_local_addr_free); 123 call_rcu(&addr->rcu, sctp_local_addr_free);
122 break; 124 break;
123 } 125 }
@@ -966,7 +968,7 @@ static struct inet6_protocol sctpv6_protocol = {
966 .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_FINAL, 968 .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_FINAL,
967}; 969};
968 970
969static struct sctp_af sctp_ipv6_specific = { 971static struct sctp_af sctp_af_inet6 = {
970 .sa_family = AF_INET6, 972 .sa_family = AF_INET6,
971 .sctp_xmit = sctp_v6_xmit, 973 .sctp_xmit = sctp_v6_xmit,
972 .setsockopt = ipv6_setsockopt, 974 .setsockopt = ipv6_setsockopt,
@@ -998,7 +1000,7 @@ static struct sctp_af sctp_ipv6_specific = {
998#endif 1000#endif
999}; 1001};
1000 1002
1001static struct sctp_pf sctp_pf_inet6_specific = { 1003static struct sctp_pf sctp_pf_inet6 = {
1002 .event_msgname = sctp_inet6_event_msgname, 1004 .event_msgname = sctp_inet6_event_msgname,
1003 .skb_msgname = sctp_inet6_skb_msgname, 1005 .skb_msgname = sctp_inet6_skb_msgname,
1004 .af_supported = sctp_inet6_af_supported, 1006 .af_supported = sctp_inet6_af_supported,
@@ -1008,7 +1010,7 @@ static struct sctp_pf sctp_pf_inet6_specific = {
1008 .supported_addrs = sctp_inet6_supported_addrs, 1010 .supported_addrs = sctp_inet6_supported_addrs,
1009 .create_accept_sk = sctp_v6_create_accept_sk, 1011 .create_accept_sk = sctp_v6_create_accept_sk,
1010 .addr_v4map = sctp_v6_addr_v4map, 1012 .addr_v4map = sctp_v6_addr_v4map,
1011 .af = &sctp_ipv6_specific, 1013 .af = &sctp_af_inet6,
1012}; 1014};
1013 1015
1014/* Initialize IPv6 support and register with socket layer. */ 1016/* Initialize IPv6 support and register with socket layer. */
@@ -1017,10 +1019,10 @@ int sctp_v6_init(void)
1017 int rc; 1019 int rc;
1018 1020
1019 /* Register the SCTP specific PF_INET6 functions. */ 1021 /* Register the SCTP specific PF_INET6 functions. */
1020 sctp_register_pf(&sctp_pf_inet6_specific, PF_INET6); 1022 sctp_register_pf(&sctp_pf_inet6, PF_INET6);
1021 1023
1022 /* Register the SCTP specific AF_INET6 functions. */ 1024 /* Register the SCTP specific AF_INET6 functions. */
1023 sctp_register_af(&sctp_ipv6_specific); 1025 sctp_register_af(&sctp_af_inet6);
1024 1026
1025 rc = proto_register(&sctpv6_prot, 1); 1027 rc = proto_register(&sctpv6_prot, 1);
1026 if (rc) 1028 if (rc)
@@ -1051,7 +1053,7 @@ void sctp_v6_exit(void)
1051 inet6_unregister_protosw(&sctpv6_seqpacket_protosw); 1053 inet6_unregister_protosw(&sctpv6_seqpacket_protosw);
1052 inet6_unregister_protosw(&sctpv6_stream_protosw); 1054 inet6_unregister_protosw(&sctpv6_stream_protosw);
1053 proto_unregister(&sctpv6_prot); 1055 proto_unregister(&sctpv6_prot);
1054 list_del(&sctp_ipv6_specific.list); 1056 list_del(&sctp_af_inet6.list);
1055} 1057}
1056 1058
1057/* Unregister with inet6 layer. */ 1059/* Unregister with inet6 layer. */
diff --git a/net/sctp/objcnt.c b/net/sctp/objcnt.c
index 14e294e37626..cfeb07ea1b04 100644
--- a/net/sctp/objcnt.c
+++ b/net/sctp/objcnt.c
@@ -132,12 +132,11 @@ void sctp_dbg_objcnt_init(void)
132{ 132{
133 struct proc_dir_entry *ent; 133 struct proc_dir_entry *ent;
134 134
135 ent = create_proc_entry("sctp_dbg_objcnt", 0, proc_net_sctp); 135 ent = proc_create("sctp_dbg_objcnt", 0,
136 proc_net_sctp, &sctp_objcnt_ops);
136 if (!ent) 137 if (!ent)
137 printk(KERN_WARNING 138 printk(KERN_WARNING
138 "sctp_dbg_objcnt: Unable to create /proc entry.\n"); 139 "sctp_dbg_objcnt: Unable to create /proc entry.\n");
139 else
140 ent->proc_fops = &sctp_objcnt_ops;
141} 140}
142 141
143/* Cleanup the objcount entry in the proc filesystem. */ 142/* Cleanup the objcount entry in the proc filesystem. */
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 69bb5a63fd8b..973f1dbc2ec3 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -108,12 +108,10 @@ int __init sctp_snmp_proc_init(void)
108{ 108{
109 struct proc_dir_entry *p; 109 struct proc_dir_entry *p;
110 110
111 p = create_proc_entry("snmp", S_IRUGO, proc_net_sctp); 111 p = proc_create("snmp", S_IRUGO, proc_net_sctp, &sctp_snmp_seq_fops);
112 if (!p) 112 if (!p)
113 return -ENOMEM; 113 return -ENOMEM;
114 114
115 p->proc_fops = &sctp_snmp_seq_fops;
116
117 return 0; 115 return 0;
118} 116}
119 117
@@ -258,12 +256,10 @@ int __init sctp_eps_proc_init(void)
258{ 256{
259 struct proc_dir_entry *p; 257 struct proc_dir_entry *p;
260 258
261 p = create_proc_entry("eps", S_IRUGO, proc_net_sctp); 259 p = proc_create("eps", S_IRUGO, proc_net_sctp, &sctp_eps_seq_fops);
262 if (!p) 260 if (!p)
263 return -ENOMEM; 261 return -ENOMEM;
264 262
265 p->proc_fops = &sctp_eps_seq_fops;
266
267 return 0; 263 return 0;
268} 264}
269 265
@@ -369,12 +365,11 @@ int __init sctp_assocs_proc_init(void)
369{ 365{
370 struct proc_dir_entry *p; 366 struct proc_dir_entry *p;
371 367
372 p = create_proc_entry("assocs", S_IRUGO, proc_net_sctp); 368 p = proc_create("assocs", S_IRUGO, proc_net_sctp,
369 &sctp_assocs_seq_fops);
373 if (!p) 370 if (!p)
374 return -ENOMEM; 371 return -ENOMEM;
375 372
376 p->proc_fops = &sctp_assocs_seq_fops;
377
378 return 0; 373 return 0;
379} 374}
380 375
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 22a16571499c..ad0a4069b95b 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -628,6 +628,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
628 struct in_ifaddr *ifa = (struct in_ifaddr *)ptr; 628 struct in_ifaddr *ifa = (struct in_ifaddr *)ptr;
629 struct sctp_sockaddr_entry *addr = NULL; 629 struct sctp_sockaddr_entry *addr = NULL;
630 struct sctp_sockaddr_entry *temp; 630 struct sctp_sockaddr_entry *temp;
631 int found = 0;
631 632
632 switch (ev) { 633 switch (ev) {
633 case NETDEV_UP: 634 case NETDEV_UP:
@@ -647,13 +648,14 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
647 list_for_each_entry_safe(addr, temp, 648 list_for_each_entry_safe(addr, temp,
648 &sctp_local_addr_list, list) { 649 &sctp_local_addr_list, list) {
649 if (addr->a.v4.sin_addr.s_addr == ifa->ifa_local) { 650 if (addr->a.v4.sin_addr.s_addr == ifa->ifa_local) {
651 found = 1;
650 addr->valid = 0; 652 addr->valid = 0;
651 list_del_rcu(&addr->list); 653 list_del_rcu(&addr->list);
652 break; 654 break;
653 } 655 }
654 } 656 }
655 spin_unlock_bh(&sctp_local_addr_lock); 657 spin_unlock_bh(&sctp_local_addr_lock);
656 if (addr && !addr->valid) 658 if (found)
657 call_rcu(&addr->rcu, sctp_local_addr_free); 659 call_rcu(&addr->rcu, sctp_local_addr_free);
658 break; 660 break;
659 } 661 }
@@ -832,7 +834,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
832 return ip_queue_xmit(skb, ipfragok); 834 return ip_queue_xmit(skb, ipfragok);
833} 835}
834 836
835static struct sctp_af sctp_ipv4_specific; 837static struct sctp_af sctp_af_inet;
836 838
837static struct sctp_pf sctp_pf_inet = { 839static struct sctp_pf sctp_pf_inet = {
838 .event_msgname = sctp_inet_event_msgname, 840 .event_msgname = sctp_inet_event_msgname,
@@ -844,7 +846,7 @@ static struct sctp_pf sctp_pf_inet = {
844 .supported_addrs = sctp_inet_supported_addrs, 846 .supported_addrs = sctp_inet_supported_addrs,
845 .create_accept_sk = sctp_v4_create_accept_sk, 847 .create_accept_sk = sctp_v4_create_accept_sk,
846 .addr_v4map = sctp_v4_addr_v4map, 848 .addr_v4map = sctp_v4_addr_v4map,
847 .af = &sctp_ipv4_specific, 849 .af = &sctp_af_inet
848}; 850};
849 851
850/* Notifier for inetaddr addition/deletion events. */ 852/* Notifier for inetaddr addition/deletion events. */
@@ -906,7 +908,7 @@ static struct net_protocol sctp_protocol = {
906}; 908};
907 909
908/* IPv4 address related functions. */ 910/* IPv4 address related functions. */
909static struct sctp_af sctp_ipv4_specific = { 911static struct sctp_af sctp_af_inet = {
910 .sa_family = AF_INET, 912 .sa_family = AF_INET,
911 .sctp_xmit = sctp_v4_xmit, 913 .sctp_xmit = sctp_v4_xmit,
912 .setsockopt = ip_setsockopt, 914 .setsockopt = ip_setsockopt,
@@ -1192,7 +1194,7 @@ SCTP_STATIC __init int sctp_init(void)
1192 sctp_sysctl_register(); 1194 sctp_sysctl_register();
1193 1195
1194 INIT_LIST_HEAD(&sctp_address_families); 1196 INIT_LIST_HEAD(&sctp_address_families);
1195 sctp_register_af(&sctp_ipv4_specific); 1197 sctp_register_af(&sctp_af_inet);
1196 1198
1197 status = proto_register(&sctp_prot, 1); 1199 status = proto_register(&sctp_prot, 1);
1198 if (status) 1200 if (status)
@@ -1249,7 +1251,7 @@ err_v6_init:
1249 proto_unregister(&sctp_prot); 1251 proto_unregister(&sctp_prot);
1250err_proto_register: 1252err_proto_register:
1251 sctp_sysctl_unregister(); 1253 sctp_sysctl_unregister();
1252 list_del(&sctp_ipv4_specific.list); 1254 list_del(&sctp_af_inet.list);
1253 free_pages((unsigned long)sctp_port_hashtable, 1255 free_pages((unsigned long)sctp_port_hashtable,
1254 get_order(sctp_port_hashsize * 1256 get_order(sctp_port_hashsize *
1255 sizeof(struct sctp_bind_hashbucket))); 1257 sizeof(struct sctp_bind_hashbucket)));
@@ -1299,7 +1301,7 @@ SCTP_STATIC __exit void sctp_exit(void)
1299 inet_unregister_protosw(&sctp_seqpacket_protosw); 1301 inet_unregister_protosw(&sctp_seqpacket_protosw);
1300 1302
1301 sctp_sysctl_unregister(); 1303 sctp_sysctl_unregister();
1302 list_del(&sctp_ipv4_specific.list); 1304 list_del(&sctp_af_inet.list);
1303 1305
1304 free_pages((unsigned long)sctp_assoc_hashtable, 1306 free_pages((unsigned long)sctp_assoc_hashtable,
1305 get_order(sctp_assoc_hashsize * 1307 get_order(sctp_assoc_hashsize *
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index e45be4e3f80d..578630e8e00d 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2375,6 +2375,14 @@ static int sctp_process_param(struct sctp_association *asoc,
2375 asoc->peer.ipv4_address = 0; 2375 asoc->peer.ipv4_address = 0;
2376 asoc->peer.ipv6_address = 0; 2376 asoc->peer.ipv6_address = 0;
2377 2377
2378 /* Assume that peer supports the address family
2379 * by which it sends a packet.
2380 */
2381 if (peer_addr->sa.sa_family == AF_INET6)
2382 asoc->peer.ipv6_address = 1;
2383 else if (peer_addr->sa.sa_family == AF_INET)
2384 asoc->peer.ipv4_address = 1;
2385
2378 /* Cycle through address types; avoid divide by 0. */ 2386 /* Cycle through address types; avoid divide by 0. */
2379 sat = ntohs(param.p->length) - sizeof(sctp_paramhdr_t); 2387 sat = ntohs(param.p->length) - sizeof(sctp_paramhdr_t);
2380 if (sat) 2388 if (sat)
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 44797ad88a05..d994d822900d 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1964,7 +1964,7 @@ static int sctp_setsockopt_disable_fragments(struct sock *sk,
1964static int sctp_setsockopt_events(struct sock *sk, char __user *optval, 1964static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
1965 int optlen) 1965 int optlen)
1966{ 1966{
1967 if (optlen != sizeof(struct sctp_event_subscribe)) 1967 if (optlen > sizeof(struct sctp_event_subscribe))
1968 return -EINVAL; 1968 return -EINVAL;
1969 if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen)) 1969 if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen))
1970 return -EFAULT; 1970 return -EFAULT;
@@ -2933,17 +2933,39 @@ static int sctp_setsockopt_maxburst(struct sock *sk,
2933 char __user *optval, 2933 char __user *optval,
2934 int optlen) 2934 int optlen)
2935{ 2935{
2936 struct sctp_assoc_value params;
2937 struct sctp_sock *sp;
2938 struct sctp_association *asoc;
2936 int val; 2939 int val;
2940 int assoc_id = 0;
2937 2941
2938 if (optlen != sizeof(int)) 2942 if (optlen < sizeof(int))
2939 return -EINVAL; 2943 return -EINVAL;
2940 if (get_user(val, (int __user *)optval))
2941 return -EFAULT;
2942 2944
2943 if (val < 0) 2945 if (optlen == sizeof(int)) {
2946 printk(KERN_WARNING
2947 "SCTP: Use of int in max_burst socket option deprecated\n");
2948 printk(KERN_WARNING
2949 "SCTP: Use struct sctp_assoc_value instead\n");
2950 if (copy_from_user(&val, optval, optlen))
2951 return -EFAULT;
2952 } else if (optlen == sizeof(struct sctp_assoc_value)) {
2953 if (copy_from_user(&params, optval, optlen))
2954 return -EFAULT;
2955 val = params.assoc_value;
2956 assoc_id = params.assoc_id;
2957 } else
2944 return -EINVAL; 2958 return -EINVAL;
2945 2959
2946 sctp_sk(sk)->max_burst = val; 2960 sp = sctp_sk(sk);
2961
2962 if (assoc_id != 0) {
2963 asoc = sctp_id2assoc(sk, assoc_id);
2964 if (!asoc)
2965 return -EINVAL;
2966 asoc->max_burst = val;
2967 } else
2968 sp->max_burst = val;
2947 2969
2948 return 0; 2970 return 0;
2949} 2971}
@@ -5005,20 +5027,45 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
5005 char __user *optval, 5027 char __user *optval,
5006 int __user *optlen) 5028 int __user *optlen)
5007{ 5029{
5008 int val; 5030 struct sctp_assoc_value params;
5031 struct sctp_sock *sp;
5032 struct sctp_association *asoc;
5009 5033
5010 if (len < sizeof(int)) 5034 if (len < sizeof(int))
5011 return -EINVAL; 5035 return -EINVAL;
5012 5036
5013 len = sizeof(int); 5037 if (len == sizeof(int)) {
5038 printk(KERN_WARNING
5039 "SCTP: Use of int in max_burst socket option deprecated\n");
5040 printk(KERN_WARNING
5041 "SCTP: Use struct sctp_assoc_value instead\n");
5042 params.assoc_id = 0;
5043 } else if (len == sizeof (struct sctp_assoc_value)) {
5044 if (copy_from_user(&params, optval, len))
5045 return -EFAULT;
5046 } else
5047 return -EINVAL;
5014 5048
5015 val = sctp_sk(sk)->max_burst; 5049 sp = sctp_sk(sk);
5016 if (put_user(len, optlen)) 5050
5017 return -EFAULT; 5051 if (params.assoc_id != 0) {
5018 if (copy_to_user(optval, &val, len)) 5052 asoc = sctp_id2assoc(sk, params.assoc_id);
5019 return -EFAULT; 5053 if (!asoc)
5054 return -EINVAL;
5055 params.assoc_value = asoc->max_burst;
5056 } else
5057 params.assoc_value = sp->max_burst;
5058
5059 if (len == sizeof(int)) {
5060 if (copy_to_user(optval, &params.assoc_value, len))
5061 return -EFAULT;
5062 } else {
5063 if (copy_to_user(optval, &params, len))
5064 return -EFAULT;
5065 }
5066
5067 return 0;
5020 5068
5021 return -ENOTSUPP;
5022} 5069}
5023 5070
5024static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, 5071static int sctp_getsockopt_hmac_ident(struct sock *sk, int len,
@@ -5070,6 +5117,7 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
5070 struct sctp_authchunks val; 5117 struct sctp_authchunks val;
5071 struct sctp_association *asoc; 5118 struct sctp_association *asoc;
5072 struct sctp_chunks_param *ch; 5119 struct sctp_chunks_param *ch;
5120 u32 num_chunks;
5073 char __user *to; 5121 char __user *to;
5074 5122
5075 if (len <= sizeof(struct sctp_authchunks)) 5123 if (len <= sizeof(struct sctp_authchunks))
@@ -5086,12 +5134,15 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
5086 ch = asoc->peer.peer_chunks; 5134 ch = asoc->peer.peer_chunks;
5087 5135
5088 /* See if the user provided enough room for all the data */ 5136 /* See if the user provided enough room for all the data */
5089 if (len < ntohs(ch->param_hdr.length)) 5137 num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t);
5138 if (len < num_chunks)
5090 return -EINVAL; 5139 return -EINVAL;
5091 5140
5092 len = ntohs(ch->param_hdr.length); 5141 len = num_chunks;
5093 if (put_user(len, optlen)) 5142 if (put_user(len, optlen))
5094 return -EFAULT; 5143 return -EFAULT;
5144 if (put_user(num_chunks, &p->gauth_number_of_chunks))
5145 return -EFAULT;
5095 if (copy_to_user(to, ch->chunks, len)) 5146 if (copy_to_user(to, ch->chunks, len))
5096 return -EFAULT; 5147 return -EFAULT;
5097 5148
@@ -5105,6 +5156,7 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
5105 struct sctp_authchunks val; 5156 struct sctp_authchunks val;
5106 struct sctp_association *asoc; 5157 struct sctp_association *asoc;
5107 struct sctp_chunks_param *ch; 5158 struct sctp_chunks_param *ch;
5159 u32 num_chunks;
5108 char __user *to; 5160 char __user *to;
5109 5161
5110 if (len <= sizeof(struct sctp_authchunks)) 5162 if (len <= sizeof(struct sctp_authchunks))
@@ -5123,12 +5175,15 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
5123 else 5175 else
5124 ch = sctp_sk(sk)->ep->auth_chunk_list; 5176 ch = sctp_sk(sk)->ep->auth_chunk_list;
5125 5177
5126 if (len < ntohs(ch->param_hdr.length)) 5178 num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t);
5179 if (len < num_chunks)
5127 return -EINVAL; 5180 return -EINVAL;
5128 5181
5129 len = ntohs(ch->param_hdr.length); 5182 len = num_chunks;
5130 if (put_user(len, optlen)) 5183 if (put_user(len, optlen))
5131 return -EFAULT; 5184 return -EFAULT;
5185 if (put_user(num_chunks, &p->gauth_number_of_chunks))
5186 return -EFAULT;
5132 if (copy_to_user(to, ch->chunks, len)) 5187 if (copy_to_user(to, ch->chunks, len))
5133 return -EFAULT; 5188 return -EFAULT;
5134 5189
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index e27b11f18b7f..b43f1f110f87 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -206,7 +206,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
206 * This field is the total length of the notification data, including 206 * This field is the total length of the notification data, including
207 * the notification header. 207 * the notification header.
208 */ 208 */
209 sac->sac_length = sizeof(struct sctp_assoc_change); 209 sac->sac_length = skb->len;
210 210
211 /* Socket Extensions for SCTP 211 /* Socket Extensions for SCTP
212 * 5.3.1.1 SCTP_ASSOC_CHANGE 212 * 5.3.1.1 SCTP_ASSOC_CHANGE
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 636c8e04e0be..b5f2786251b9 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -316,31 +316,29 @@ static int create_cache_proc_entries(struct cache_detail *cd)
316 cd->proc_ent->owner = cd->owner; 316 cd->proc_ent->owner = cd->owner;
317 cd->channel_ent = cd->content_ent = NULL; 317 cd->channel_ent = cd->content_ent = NULL;
318 318
319 p = create_proc_entry("flush", S_IFREG|S_IRUSR|S_IWUSR, cd->proc_ent); 319 p = proc_create("flush", S_IFREG|S_IRUSR|S_IWUSR,
320 cd->proc_ent, &cache_flush_operations);
320 cd->flush_ent = p; 321 cd->flush_ent = p;
321 if (p == NULL) 322 if (p == NULL)
322 goto out_nomem; 323 goto out_nomem;
323 p->proc_fops = &cache_flush_operations;
324 p->owner = cd->owner; 324 p->owner = cd->owner;
325 p->data = cd; 325 p->data = cd;
326 326
327 if (cd->cache_request || cd->cache_parse) { 327 if (cd->cache_request || cd->cache_parse) {
328 p = create_proc_entry("channel", S_IFREG|S_IRUSR|S_IWUSR, 328 p = proc_create("channel", S_IFREG|S_IRUSR|S_IWUSR,
329 cd->proc_ent); 329 cd->proc_ent, &cache_file_operations);
330 cd->channel_ent = p; 330 cd->channel_ent = p;
331 if (p == NULL) 331 if (p == NULL)
332 goto out_nomem; 332 goto out_nomem;
333 p->proc_fops = &cache_file_operations;
334 p->owner = cd->owner; 333 p->owner = cd->owner;
335 p->data = cd; 334 p->data = cd;
336 } 335 }
337 if (cd->cache_show) { 336 if (cd->cache_show) {
338 p = create_proc_entry("content", S_IFREG|S_IRUSR|S_IWUSR, 337 p = proc_create("content", S_IFREG|S_IRUSR|S_IWUSR,
339 cd->proc_ent); 338 cd->proc_ent, &content_file_operations);
340 cd->content_ent = p; 339 cd->content_ent = p;
341 if (p == NULL) 340 if (p == NULL)
342 goto out_nomem; 341 goto out_nomem;
343 p->proc_fops = &content_file_operations;
344 p->owner = cd->owner; 342 p->owner = cd->owner;
345 p->data = cd; 343 p->data = cd;
346 } 344 }
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 5a16875f5ac8..c6061a4346c8 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -229,9 +229,8 @@ do_register(const char *name, void *data, const struct file_operations *fops)
229 rpc_proc_init(); 229 rpc_proc_init();
230 dprintk("RPC: registering /proc/net/rpc/%s\n", name); 230 dprintk("RPC: registering /proc/net/rpc/%s\n", name);
231 231
232 ent = create_proc_entry(name, 0, proc_net_rpc); 232 ent = proc_create(name, 0, proc_net_rpc, fops);
233 if (ent) { 233 if (ent) {
234 ent->proc_fops = fops;
235 ent->data = data; 234 ent->data = data;
236 } 235 }
237 return ent; 236 return ent;
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index 0598b229c11d..981f190c1b39 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -156,7 +156,7 @@ static int send_write(struct svcxprt_rdma *xprt, struct svc_rqst *rqstp,
156 struct svc_rdma_op_ctxt *ctxt; 156 struct svc_rdma_op_ctxt *ctxt;
157 int ret = 0; 157 int ret = 0;
158 158
159 BUG_ON(sge_count >= 32); 159 BUG_ON(sge_count > RPCSVC_MAXPAGES);
160 dprintk("svcrdma: RDMA_WRITE rmr=%x, to=%llx, xdr_off=%d, " 160 dprintk("svcrdma: RDMA_WRITE rmr=%x, to=%llx, xdr_off=%d, "
161 "write_len=%d, xdr_sge=%p, sge_count=%d\n", 161 "write_len=%d, xdr_sge=%p, sge_count=%d\n",
162 rmr, (unsigned long long)to, xdr_off, 162 rmr, (unsigned long long)to, xdr_off,
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index f09444c451bc..16fd3f6718ff 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -54,7 +54,6 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
54 int flags); 54 int flags);
55static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt); 55static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt);
56static void svc_rdma_release_rqst(struct svc_rqst *); 56static void svc_rdma_release_rqst(struct svc_rqst *);
57static void rdma_destroy_xprt(struct svcxprt_rdma *xprt);
58static void dto_tasklet_func(unsigned long data); 57static void dto_tasklet_func(unsigned long data);
59static void svc_rdma_detach(struct svc_xprt *xprt); 58static void svc_rdma_detach(struct svc_xprt *xprt);
60static void svc_rdma_free(struct svc_xprt *xprt); 59static void svc_rdma_free(struct svc_xprt *xprt);
@@ -247,6 +246,7 @@ static void dto_tasklet_func(unsigned long data)
247 sq_cq_reap(xprt); 246 sq_cq_reap(xprt);
248 } 247 }
249 248
249 svc_xprt_put(&xprt->sc_xprt);
250 spin_lock_irqsave(&dto_lock, flags); 250 spin_lock_irqsave(&dto_lock, flags);
251 } 251 }
252 spin_unlock_irqrestore(&dto_lock, flags); 252 spin_unlock_irqrestore(&dto_lock, flags);
@@ -275,8 +275,10 @@ static void rq_comp_handler(struct ib_cq *cq, void *cq_context)
275 * add it 275 * add it
276 */ 276 */
277 spin_lock_irqsave(&dto_lock, flags); 277 spin_lock_irqsave(&dto_lock, flags);
278 if (list_empty(&xprt->sc_dto_q)) 278 if (list_empty(&xprt->sc_dto_q)) {
279 svc_xprt_get(&xprt->sc_xprt);
279 list_add_tail(&xprt->sc_dto_q, &dto_xprt_q); 280 list_add_tail(&xprt->sc_dto_q, &dto_xprt_q);
281 }
280 spin_unlock_irqrestore(&dto_lock, flags); 282 spin_unlock_irqrestore(&dto_lock, flags);
281 283
282 /* Tasklet does all the work to avoid irqsave locks. */ 284 /* Tasklet does all the work to avoid irqsave locks. */
@@ -386,8 +388,10 @@ static void sq_comp_handler(struct ib_cq *cq, void *cq_context)
386 * add it 388 * add it
387 */ 389 */
388 spin_lock_irqsave(&dto_lock, flags); 390 spin_lock_irqsave(&dto_lock, flags);
389 if (list_empty(&xprt->sc_dto_q)) 391 if (list_empty(&xprt->sc_dto_q)) {
392 svc_xprt_get(&xprt->sc_xprt);
390 list_add_tail(&xprt->sc_dto_q, &dto_xprt_q); 393 list_add_tail(&xprt->sc_dto_q, &dto_xprt_q);
394 }
391 spin_unlock_irqrestore(&dto_lock, flags); 395 spin_unlock_irqrestore(&dto_lock, flags);
392 396
393 /* Tasklet does all the work to avoid irqsave locks. */ 397 /* Tasklet does all the work to avoid irqsave locks. */
@@ -611,6 +615,7 @@ static int rdma_cma_handler(struct rdma_cm_id *cma_id,
611 switch (event->event) { 615 switch (event->event) {
612 case RDMA_CM_EVENT_ESTABLISHED: 616 case RDMA_CM_EVENT_ESTABLISHED:
613 /* Accept complete */ 617 /* Accept complete */
618 svc_xprt_get(xprt);
614 dprintk("svcrdma: Connection completed on DTO xprt=%p, " 619 dprintk("svcrdma: Connection completed on DTO xprt=%p, "
615 "cm_id=%p\n", xprt, cma_id); 620 "cm_id=%p\n", xprt, cma_id);
616 clear_bit(RDMAXPRT_CONN_PENDING, &rdma->sc_flags); 621 clear_bit(RDMAXPRT_CONN_PENDING, &rdma->sc_flags);
@@ -661,15 +666,15 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
661 666
662 listen_id = rdma_create_id(rdma_listen_handler, cma_xprt, RDMA_PS_TCP); 667 listen_id = rdma_create_id(rdma_listen_handler, cma_xprt, RDMA_PS_TCP);
663 if (IS_ERR(listen_id)) { 668 if (IS_ERR(listen_id)) {
664 rdma_destroy_xprt(cma_xprt); 669 svc_xprt_put(&cma_xprt->sc_xprt);
665 dprintk("svcrdma: rdma_create_id failed = %ld\n", 670 dprintk("svcrdma: rdma_create_id failed = %ld\n",
666 PTR_ERR(listen_id)); 671 PTR_ERR(listen_id));
667 return (void *)listen_id; 672 return (void *)listen_id;
668 } 673 }
669 ret = rdma_bind_addr(listen_id, sa); 674 ret = rdma_bind_addr(listen_id, sa);
670 if (ret) { 675 if (ret) {
671 rdma_destroy_xprt(cma_xprt);
672 rdma_destroy_id(listen_id); 676 rdma_destroy_id(listen_id);
677 svc_xprt_put(&cma_xprt->sc_xprt);
673 dprintk("svcrdma: rdma_bind_addr failed = %d\n", ret); 678 dprintk("svcrdma: rdma_bind_addr failed = %d\n", ret);
674 return ERR_PTR(ret); 679 return ERR_PTR(ret);
675 } 680 }
@@ -678,8 +683,9 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
678 ret = rdma_listen(listen_id, RPCRDMA_LISTEN_BACKLOG); 683 ret = rdma_listen(listen_id, RPCRDMA_LISTEN_BACKLOG);
679 if (ret) { 684 if (ret) {
680 rdma_destroy_id(listen_id); 685 rdma_destroy_id(listen_id);
681 rdma_destroy_xprt(cma_xprt); 686 svc_xprt_put(&cma_xprt->sc_xprt);
682 dprintk("svcrdma: rdma_listen failed = %d\n", ret); 687 dprintk("svcrdma: rdma_listen failed = %d\n", ret);
688 return ERR_PTR(ret);
683 } 689 }
684 690
685 /* 691 /*
@@ -820,6 +826,7 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
820 newxprt->sc_sq_depth = qp_attr.cap.max_send_wr; 826 newxprt->sc_sq_depth = qp_attr.cap.max_send_wr;
821 newxprt->sc_max_requests = qp_attr.cap.max_recv_wr; 827 newxprt->sc_max_requests = qp_attr.cap.max_recv_wr;
822 } 828 }
829 svc_xprt_get(&newxprt->sc_xprt);
823 newxprt->sc_qp = newxprt->sc_cm_id->qp; 830 newxprt->sc_qp = newxprt->sc_cm_id->qp;
824 831
825 /* Register all of physical memory */ 832 /* Register all of physical memory */
@@ -891,8 +898,15 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
891 898
892 errout: 899 errout:
893 dprintk("svcrdma: failure accepting new connection rc=%d.\n", ret); 900 dprintk("svcrdma: failure accepting new connection rc=%d.\n", ret);
901 /* Take a reference in case the DTO handler runs */
902 svc_xprt_get(&newxprt->sc_xprt);
903 if (newxprt->sc_qp && !IS_ERR(newxprt->sc_qp)) {
904 ib_destroy_qp(newxprt->sc_qp);
905 svc_xprt_put(&newxprt->sc_xprt);
906 }
894 rdma_destroy_id(newxprt->sc_cm_id); 907 rdma_destroy_id(newxprt->sc_cm_id);
895 rdma_destroy_xprt(newxprt); 908 /* This call to put will destroy the transport */
909 svc_xprt_put(&newxprt->sc_xprt);
896 return NULL; 910 return NULL;
897} 911}
898 912
@@ -919,54 +933,60 @@ static void svc_rdma_release_rqst(struct svc_rqst *rqstp)
919 rqstp->rq_xprt_ctxt = NULL; 933 rqstp->rq_xprt_ctxt = NULL;
920} 934}
921 935
922/* Disable data ready events for this connection */ 936/*
937 * When connected, an svc_xprt has at least three references:
938 *
939 * - A reference held by the QP. We still hold that here because this
940 * code deletes the QP and puts the reference.
941 *
942 * - A reference held by the cm_id between the ESTABLISHED and
943 * DISCONNECTED events. If the remote peer disconnected first, this
944 * reference could be gone.
945 *
946 * - A reference held by the svc_recv code that called this function
947 * as part of close processing.
948 *
949 * At a minimum two references should still be held.
950 */
923static void svc_rdma_detach(struct svc_xprt *xprt) 951static void svc_rdma_detach(struct svc_xprt *xprt)
924{ 952{
925 struct svcxprt_rdma *rdma = 953 struct svcxprt_rdma *rdma =
926 container_of(xprt, struct svcxprt_rdma, sc_xprt); 954 container_of(xprt, struct svcxprt_rdma, sc_xprt);
927 unsigned long flags;
928
929 dprintk("svc: svc_rdma_detach(%p)\n", xprt); 955 dprintk("svc: svc_rdma_detach(%p)\n", xprt);
930 /* 956
931 * Shutdown the connection. This will ensure we don't get any 957 /* Disconnect and flush posted WQE */
932 * more events from the provider.
933 */
934 rdma_disconnect(rdma->sc_cm_id); 958 rdma_disconnect(rdma->sc_cm_id);
935 rdma_destroy_id(rdma->sc_cm_id);
936 959
937 /* We may already be on the DTO list */ 960 /* Destroy the QP if present (not a listener) */
938 spin_lock_irqsave(&dto_lock, flags); 961 if (rdma->sc_qp && !IS_ERR(rdma->sc_qp)) {
939 if (!list_empty(&rdma->sc_dto_q)) 962 ib_destroy_qp(rdma->sc_qp);
940 list_del_init(&rdma->sc_dto_q); 963 svc_xprt_put(xprt);
941 spin_unlock_irqrestore(&dto_lock, flags); 964 }
965
966 /* Destroy the CM ID */
967 rdma_destroy_id(rdma->sc_cm_id);
942} 968}
943 969
944static void svc_rdma_free(struct svc_xprt *xprt) 970static void svc_rdma_free(struct svc_xprt *xprt)
945{ 971{
946 struct svcxprt_rdma *rdma = (struct svcxprt_rdma *)xprt; 972 struct svcxprt_rdma *rdma = (struct svcxprt_rdma *)xprt;
947 dprintk("svcrdma: svc_rdma_free(%p)\n", rdma); 973 dprintk("svcrdma: svc_rdma_free(%p)\n", rdma);
948 rdma_destroy_xprt(rdma); 974 /* We should only be called from kref_put */
949 kfree(rdma); 975 BUG_ON(atomic_read(&xprt->xpt_ref.refcount) != 0);
950} 976 if (rdma->sc_sq_cq && !IS_ERR(rdma->sc_sq_cq))
951 977 ib_destroy_cq(rdma->sc_sq_cq);
952static void rdma_destroy_xprt(struct svcxprt_rdma *xprt)
953{
954 if (xprt->sc_qp && !IS_ERR(xprt->sc_qp))
955 ib_destroy_qp(xprt->sc_qp);
956
957 if (xprt->sc_sq_cq && !IS_ERR(xprt->sc_sq_cq))
958 ib_destroy_cq(xprt->sc_sq_cq);
959 978
960 if (xprt->sc_rq_cq && !IS_ERR(xprt->sc_rq_cq)) 979 if (rdma->sc_rq_cq && !IS_ERR(rdma->sc_rq_cq))
961 ib_destroy_cq(xprt->sc_rq_cq); 980 ib_destroy_cq(rdma->sc_rq_cq);
962 981
963 if (xprt->sc_phys_mr && !IS_ERR(xprt->sc_phys_mr)) 982 if (rdma->sc_phys_mr && !IS_ERR(rdma->sc_phys_mr))
964 ib_dereg_mr(xprt->sc_phys_mr); 983 ib_dereg_mr(rdma->sc_phys_mr);
965 984
966 if (xprt->sc_pd && !IS_ERR(xprt->sc_pd)) 985 if (rdma->sc_pd && !IS_ERR(rdma->sc_pd))
967 ib_dealloc_pd(xprt->sc_pd); 986 ib_dealloc_pd(rdma->sc_pd);
968 987
969 destroy_context_cache(xprt->sc_ctxt_head); 988 destroy_context_cache(rdma->sc_ctxt_head);
989 kfree(rdma);
970} 990}
971 991
972static int svc_rdma_has_wspace(struct svc_xprt *xprt) 992static int svc_rdma_has_wspace(struct svc_xprt *xprt)
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 02c522c17de5..a564c1a39ec5 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -614,7 +614,11 @@ xprt_rdma_free(void *buffer)
614 return; 614 return;
615 615
616 req = container_of(buffer, struct rpcrdma_req, rl_xdr_buf[0]); 616 req = container_of(buffer, struct rpcrdma_req, rl_xdr_buf[0]);
617 r_xprt = container_of(req->rl_buffer, struct rpcrdma_xprt, rx_buf); 617 if (req->rl_iov.length == 0) { /* see allocate above */
618 r_xprt = container_of(((struct rpcrdma_req *) req->rl_buffer)->rl_buffer,
619 struct rpcrdma_xprt, rx_buf);
620 } else
621 r_xprt = container_of(req->rl_buffer, struct rpcrdma_xprt, rx_buf);
618 rep = req->rl_reply; 622 rep = req->rl_reply;
619 623
620 dprintk("RPC: %s: called on 0x%p%s\n", 624 dprintk("RPC: %s: called on 0x%p%s\n",
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c
index 95b373913aa0..4bb3404f610b 100644
--- a/net/tipc/cluster.c
+++ b/net/tipc/cluster.c
@@ -142,7 +142,7 @@ void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr)
142 max_n_num = tipc_highest_allowed_slave; 142 max_n_num = tipc_highest_allowed_slave;
143 assert(n_num > 0); 143 assert(n_num > 0);
144 assert(n_num <= max_n_num); 144 assert(n_num <= max_n_num);
145 assert(c_ptr->nodes[n_num] == 0); 145 assert(c_ptr->nodes[n_num] == NULL);
146 c_ptr->nodes[n_num] = n_ptr; 146 c_ptr->nodes[n_num] = n_ptr;
147 if (n_num > c_ptr->highest_node) 147 if (n_num > c_ptr->highest_node)
148 c_ptr->highest_node = n_num; 148 c_ptr->highest_node = n_num;
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 1b17fecee747..cefa99824c58 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -3251,7 +3251,7 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
3251 if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) - 3251 if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) -
3252 msg_seqno(buf_msg(l_ptr->first_out))) 3252 msg_seqno(buf_msg(l_ptr->first_out)))
3253 != (l_ptr->out_queue_size - 1)) 3253 != (l_ptr->out_queue_size - 1))
3254 || (l_ptr->last_out->next != 0)) { 3254 || (l_ptr->last_out->next != NULL)) {
3255 tipc_printf(buf, "\nSend queue inconsistency\n"); 3255 tipc_printf(buf, "\nSend queue inconsistency\n");
3256 tipc_printf(buf, "first_out= %x ", l_ptr->first_out); 3256 tipc_printf(buf, "first_out= %x ", l_ptr->first_out);
3257 tipc_printf(buf, "next_out= %x ", l_ptr->next_out); 3257 tipc_printf(buf, "next_out= %x ", l_ptr->next_out);
diff --git a/net/tipc/ref.c b/net/tipc/ref.c
index 6704a58c7851..c38744c96ed1 100644
--- a/net/tipc/ref.c
+++ b/net/tipc/ref.c
@@ -148,7 +148,7 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
148 reference = (next_plus_upper & ~index_mask) + index; 148 reference = (next_plus_upper & ~index_mask) + index;
149 entry->data.reference = reference; 149 entry->data.reference = reference;
150 entry->object = object; 150 entry->object = object;
151 if (lock != 0) 151 if (lock != NULL)
152 *lock = &entry->lock; 152 *lock = &entry->lock;
153 spin_unlock_bh(&entry->lock); 153 spin_unlock_bh(&entry->lock);
154 } 154 }
diff --git a/net/tipc/zone.c b/net/tipc/zone.c
index 114e173f11a5..3506f8563441 100644
--- a/net/tipc/zone.c
+++ b/net/tipc/zone.c
@@ -82,7 +82,7 @@ void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr)
82 82
83 assert(c_ptr->addr); 83 assert(c_ptr->addr);
84 assert(c_num <= tipc_max_clusters); 84 assert(c_num <= tipc_max_clusters);
85 assert(z_ptr->clusters[c_num] == 0); 85 assert(z_ptr->clusters[c_num] == NULL);
86 z_ptr->clusters[c_num] = c_ptr; 86 z_ptr->clusters[c_num] = c_ptr;
87} 87}
88 88
diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c
index f2e54c3f064e..5bebe40bf4e6 100644
--- a/net/wanrouter/wanproc.c
+++ b/net/wanrouter/wanproc.c
@@ -292,14 +292,12 @@ int __init wanrouter_proc_init(void)
292 if (!proc_router) 292 if (!proc_router)
293 goto fail; 293 goto fail;
294 294
295 p = create_proc_entry("config", S_IRUGO, proc_router); 295 p = proc_create("config", S_IRUGO, proc_router, &config_fops);
296 if (!p) 296 if (!p)
297 goto fail_config; 297 goto fail_config;
298 p->proc_fops = &config_fops; 298 p = proc_create("status", S_IRUGO, proc_router, &status_fops);
299 p = create_proc_entry("status", S_IRUGO, proc_router);
300 if (!p) 299 if (!p)
301 goto fail_stat; 300 goto fail_stat;
302 p->proc_fops = &status_fops;
303 return 0; 301 return 0;
304fail_stat: 302fail_stat:
305 remove_proc_entry("config", proc_router); 303 remove_proc_entry("config", proc_router);
@@ -329,10 +327,10 @@ int wanrouter_proc_add(struct wan_device* wandev)
329 if (wandev->magic != ROUTER_MAGIC) 327 if (wandev->magic != ROUTER_MAGIC)
330 return -EINVAL; 328 return -EINVAL;
331 329
332 wandev->dent = create_proc_entry(wandev->name, S_IRUGO, proc_router); 330 wandev->dent = proc_create(wandev->name, S_IRUGO,
331 proc_router, &wandev_fops);
333 if (!wandev->dent) 332 if (!wandev->dent)
334 return -ENOMEM; 333 return -ENOMEM;
335 wandev->dent->proc_fops = &wandev_fops;
336 wandev->dent->data = wandev; 334 wandev->dent->data = wandev;
337 return 0; 335 return 0;
338} 336}
diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c
index 3f52b09bed03..1afa44d25beb 100644
--- a/net/x25/x25_proc.c
+++ b/net/x25/x25_proc.c
@@ -312,20 +312,18 @@ int __init x25_proc_init(void)
312 if (!x25_proc_dir) 312 if (!x25_proc_dir)
313 goto out; 313 goto out;
314 314
315 p = create_proc_entry("route", S_IRUGO, x25_proc_dir); 315 p = proc_create("route", S_IRUGO, x25_proc_dir, &x25_seq_route_fops);
316 if (!p) 316 if (!p)
317 goto out_route; 317 goto out_route;
318 p->proc_fops = &x25_seq_route_fops;
319 318
320 p = create_proc_entry("socket", S_IRUGO, x25_proc_dir); 319 p = proc_create("socket", S_IRUGO, x25_proc_dir, &x25_seq_socket_fops);
321 if (!p) 320 if (!p)
322 goto out_socket; 321 goto out_socket;
323 p->proc_fops = &x25_seq_socket_fops;
324 322
325 p = create_proc_entry("forward", S_IRUGO, x25_proc_dir); 323 p = proc_create("forward", S_IRUGO, x25_proc_dir,
324 &x25_seq_forward_fops);
326 if (!p) 325 if (!p)
327 goto out_forward; 326 goto out_forward;
328 p->proc_fops = &x25_seq_forward_fops;
329 rc = 0; 327 rc = 0;
330 328
331out: 329out: