aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-13 21:22:27 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-13 21:22:27 -0400
commit59aee3c2a1e69fe5062bd1facb72d6fcea3f3f8f (patch)
treeb337d73229a69e399d4e4f7128b33ce734660e35 /net
parent0d69ae5fb7eb9ba3b54cf0ba4ef5ae591f31eef7 (diff)
parent046d20b73960b7a2474b6d5e920d54c3fd7c23fe (diff)
Merge branch 'master'
Diffstat (limited to 'net')
-rw-r--r--net/atm/addr.c51
-rw-r--r--net/atm/addr.h12
-rw-r--r--net/atm/atm_misc.c2
-rw-r--r--net/atm/br2684.c2
-rw-r--r--net/atm/resources.c20
-rw-r--r--net/ax25/ax25_in.c2
-rw-r--r--net/bluetooth/l2cap.c2
-rw-r--r--net/bluetooth/rfcomm/core.c2
-rw-r--r--net/bluetooth/rfcomm/sock.c2
-rw-r--r--net/bluetooth/rfcomm/tty.c2
-rw-r--r--net/bluetooth/sco.c2
-rw-r--r--net/bridge/br_if.c2
-rw-r--r--net/bridge/netfilter/ebtables.c27
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/skbuff.c14
-rw-r--r--net/core/sock.c10
-rw-r--r--net/dccp/ackvec.c2
-rw-r--r--net/dccp/ackvec.h4
-rw-r--r--net/dccp/ccid.h4
-rw-r--r--net/dccp/ccids/lib/loss_interval.h2
-rw-r--r--net/dccp/ccids/lib/packet_history.h4
-rw-r--r--net/dccp/input.c6
-rw-r--r--net/decnet/af_decnet.c4
-rw-r--r--net/decnet/dn_nsp_out.c21
-rw-r--r--net/ieee80211/ieee80211_tx.c2
-rw-r--r--net/ipv4/esp4.c17
-rw-r--r--net/ipv4/inet_connection_sock.c2
-rw-r--r--net/ipv4/inet_timewait_sock.c1
-rw-r--r--net/ipv4/ipvs/ip_vs_app.c2
-rw-r--r--net/ipv4/netfilter/Kconfig10
-rw-r--r--net/ipv4/netfilter/arp_tables.c14
-rw-r--r--net/ipv4/netfilter/ip_conntrack_core.c13
-rw-r--r--net/ipv4/netfilter/ip_conntrack_netlink.c48
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_icmp.c3
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_tcp.c27
-rw-r--r--net/ipv4/netfilter/ip_tables.c17
-rw-r--r--net/ipv4/tcp_bic.c2
-rw-r--r--net/ipv4/tcp_output.c13
-rw-r--r--net/ipv6/esp6.c18
-rw-r--r--net/ipv6/mcast.c2
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/netfilter/ip6_tables.c16
-rw-r--r--net/key/af_key.c18
-rw-r--r--net/llc/llc_conn.c3
-rw-r--r--net/netfilter/nfnetlink.c6
-rw-r--r--net/netlink/af_netlink.c4
-rw-r--r--net/netrom/nr_dev.c2
-rw-r--r--net/rxrpc/call.c2
-rw-r--r--net/rxrpc/connection.c2
-rw-r--r--net/sched/Kconfig4
-rw-r--r--net/sctp/associola.c10
-rw-r--r--net/sctp/bind_addr.c12
-rw-r--r--net/sctp/chunk.c2
-rw-r--r--net/sctp/endpointola.c5
-rw-r--r--net/sctp/protocol.c2
-rw-r--r--net/sctp/sm_make_chunk.c14
-rw-r--r--net/sctp/sm_sideeffect.c12
-rw-r--r--net/sctp/socket.c252
-rw-r--r--net/sctp/ssnmap.c2
-rw-r--r--net/sctp/transport.c4
-rw-r--r--net/sctp/ulpevent.c18
-rw-r--r--net/sctp/ulpqueue.c8
-rw-r--r--net/sunrpc/sched.c2
-rw-r--r--net/xfrm/xfrm_policy.c6
64 files changed, 580 insertions, 220 deletions
diff --git a/net/atm/addr.c b/net/atm/addr.c
index a30d0bf48063..3060fd0ba4b9 100644
--- a/net/atm/addr.c
+++ b/net/atm/addr.c
@@ -44,31 +44,43 @@ static void notify_sigd(struct atm_dev *dev)
44 sigd_enq(NULL, as_itf_notify, NULL, &pvc, NULL); 44 sigd_enq(NULL, as_itf_notify, NULL, &pvc, NULL);
45} 45}
46 46
47void atm_reset_addr(struct atm_dev *dev) 47void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t atype)
48{ 48{
49 unsigned long flags; 49 unsigned long flags;
50 struct atm_dev_addr *this, *p; 50 struct atm_dev_addr *this, *p;
51 struct list_head *head;
51 52
52 spin_lock_irqsave(&dev->lock, flags); 53 spin_lock_irqsave(&dev->lock, flags);
53 list_for_each_entry_safe(this, p, &dev->local, entry) { 54 if (atype == ATM_ADDR_LECS)
55 head = &dev->lecs;
56 else
57 head = &dev->local;
58 list_for_each_entry_safe(this, p, head, entry) {
54 list_del(&this->entry); 59 list_del(&this->entry);
55 kfree(this); 60 kfree(this);
56 } 61 }
57 spin_unlock_irqrestore(&dev->lock, flags); 62 spin_unlock_irqrestore(&dev->lock, flags);
58 notify_sigd(dev); 63 if (head == &dev->local)
64 notify_sigd(dev);
59} 65}
60 66
61int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr) 67int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr,
68 enum atm_addr_type_t atype)
62{ 69{
63 unsigned long flags; 70 unsigned long flags;
64 struct atm_dev_addr *this; 71 struct atm_dev_addr *this;
72 struct list_head *head;
65 int error; 73 int error;
66 74
67 error = check_addr(addr); 75 error = check_addr(addr);
68 if (error) 76 if (error)
69 return error; 77 return error;
70 spin_lock_irqsave(&dev->lock, flags); 78 spin_lock_irqsave(&dev->lock, flags);
71 list_for_each_entry(this, &dev->local, entry) { 79 if (atype == ATM_ADDR_LECS)
80 head = &dev->lecs;
81 else
82 head = &dev->local;
83 list_for_each_entry(this, head, entry) {
72 if (identical(&this->addr, addr)) { 84 if (identical(&this->addr, addr)) {
73 spin_unlock_irqrestore(&dev->lock, flags); 85 spin_unlock_irqrestore(&dev->lock, flags);
74 return -EEXIST; 86 return -EEXIST;
@@ -80,28 +92,36 @@ int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr)
80 return -ENOMEM; 92 return -ENOMEM;
81 } 93 }
82 this->addr = *addr; 94 this->addr = *addr;
83 list_add(&this->entry, &dev->local); 95 list_add(&this->entry, head);
84 spin_unlock_irqrestore(&dev->lock, flags); 96 spin_unlock_irqrestore(&dev->lock, flags);
85 notify_sigd(dev); 97 if (head == &dev->local)
98 notify_sigd(dev);
86 return 0; 99 return 0;
87} 100}
88 101
89int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr) 102int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr,
103 enum atm_addr_type_t atype)
90{ 104{
91 unsigned long flags; 105 unsigned long flags;
92 struct atm_dev_addr *this; 106 struct atm_dev_addr *this;
107 struct list_head *head;
93 int error; 108 int error;
94 109
95 error = check_addr(addr); 110 error = check_addr(addr);
96 if (error) 111 if (error)
97 return error; 112 return error;
98 spin_lock_irqsave(&dev->lock, flags); 113 spin_lock_irqsave(&dev->lock, flags);
99 list_for_each_entry(this, &dev->local, entry) { 114 if (atype == ATM_ADDR_LECS)
115 head = &dev->lecs;
116 else
117 head = &dev->local;
118 list_for_each_entry(this, head, entry) {
100 if (identical(&this->addr, addr)) { 119 if (identical(&this->addr, addr)) {
101 list_del(&this->entry); 120 list_del(&this->entry);
102 spin_unlock_irqrestore(&dev->lock, flags); 121 spin_unlock_irqrestore(&dev->lock, flags);
103 kfree(this); 122 kfree(this);
104 notify_sigd(dev); 123 if (head == &dev->local)
124 notify_sigd(dev);
105 return 0; 125 return 0;
106 } 126 }
107 } 127 }
@@ -110,22 +130,27 @@ int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr)
110} 130}
111 131
112int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user * buf, 132int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user * buf,
113 size_t size) 133 size_t size, enum atm_addr_type_t atype)
114{ 134{
115 unsigned long flags; 135 unsigned long flags;
116 struct atm_dev_addr *this; 136 struct atm_dev_addr *this;
137 struct list_head *head;
117 int total = 0, error; 138 int total = 0, error;
118 struct sockaddr_atmsvc *tmp_buf, *tmp_bufp; 139 struct sockaddr_atmsvc *tmp_buf, *tmp_bufp;
119 140
120 spin_lock_irqsave(&dev->lock, flags); 141 spin_lock_irqsave(&dev->lock, flags);
121 list_for_each_entry(this, &dev->local, entry) 142 if (atype == ATM_ADDR_LECS)
143 head = &dev->lecs;
144 else
145 head = &dev->local;
146 list_for_each_entry(this, head, entry)
122 total += sizeof(struct sockaddr_atmsvc); 147 total += sizeof(struct sockaddr_atmsvc);
123 tmp_buf = tmp_bufp = kmalloc(total, GFP_ATOMIC); 148 tmp_buf = tmp_bufp = kmalloc(total, GFP_ATOMIC);
124 if (!tmp_buf) { 149 if (!tmp_buf) {
125 spin_unlock_irqrestore(&dev->lock, flags); 150 spin_unlock_irqrestore(&dev->lock, flags);
126 return -ENOMEM; 151 return -ENOMEM;
127 } 152 }
128 list_for_each_entry(this, &dev->local, entry) 153 list_for_each_entry(this, head, entry)
129 memcpy(tmp_bufp++, &this->addr, sizeof(struct sockaddr_atmsvc)); 154 memcpy(tmp_bufp++, &this->addr, sizeof(struct sockaddr_atmsvc));
130 spin_unlock_irqrestore(&dev->lock, flags); 155 spin_unlock_irqrestore(&dev->lock, flags);
131 error = total > size ? -E2BIG : total; 156 error = total > size ? -E2BIG : total;
diff --git a/net/atm/addr.h b/net/atm/addr.h
index 3099d21feeaa..f39433ad45da 100644
--- a/net/atm/addr.h
+++ b/net/atm/addr.h
@@ -9,10 +9,12 @@
9#include <linux/atm.h> 9#include <linux/atm.h>
10#include <linux/atmdev.h> 10#include <linux/atmdev.h>
11 11
12 12void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t type);
13void atm_reset_addr(struct atm_dev *dev); 13int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr,
14int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); 14 enum atm_addr_type_t type);
15int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); 15int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr,
16int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc __user *buf,size_t size); 16 enum atm_addr_type_t type);
17int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user *buf,
18 size_t size, enum atm_addr_type_t type);
17 19
18#endif 20#endif
diff --git a/net/atm/atm_misc.c b/net/atm/atm_misc.c
index b2113c3454ae..223c7ad5bd0f 100644
--- a/net/atm/atm_misc.c
+++ b/net/atm/atm_misc.c
@@ -25,7 +25,7 @@ int atm_charge(struct atm_vcc *vcc,int truesize)
25 25
26 26
27struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, 27struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
28 int gfp_flags) 28 gfp_t gfp_flags)
29{ 29{
30 struct sock *sk = sk_atm(vcc); 30 struct sock *sk = sk_atm(vcc);
31 int guess = atm_guess_pdu2truesize(pdu_size); 31 int guess = atm_guess_pdu2truesize(pdu_size);
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 289956c4dd3e..72f3f7b8de80 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -220,7 +220,7 @@ static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev)
220 /* netif_stop_queue(dev); */ 220 /* netif_stop_queue(dev); */
221 dev_kfree_skb(skb); 221 dev_kfree_skb(skb);
222 read_unlock(&devs_lock); 222 read_unlock(&devs_lock);
223 return -EUNATCH; 223 return 0;
224 } 224 }
225 if (!br2684_xmit_vcc(skb, brdev, brvcc)) { 225 if (!br2684_xmit_vcc(skb, brdev, brvcc)) {
226 /* 226 /*
diff --git a/net/atm/resources.c b/net/atm/resources.c
index a57a9268bd24..415d2615d475 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -40,6 +40,7 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
40 dev->link_rate = ATM_OC3_PCR; 40 dev->link_rate = ATM_OC3_PCR;
41 spin_lock_init(&dev->lock); 41 spin_lock_init(&dev->lock);
42 INIT_LIST_HEAD(&dev->local); 42 INIT_LIST_HEAD(&dev->local);
43 INIT_LIST_HEAD(&dev->lecs);
43 44
44 return dev; 45 return dev;
45} 46}
@@ -320,10 +321,12 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
320 error = -EPERM; 321 error = -EPERM;
321 goto done; 322 goto done;
322 } 323 }
323 atm_reset_addr(dev); 324 atm_reset_addr(dev, ATM_ADDR_LOCAL);
324 break; 325 break;
325 case ATM_ADDADDR: 326 case ATM_ADDADDR:
326 case ATM_DELADDR: 327 case ATM_DELADDR:
328 case ATM_ADDLECSADDR:
329 case ATM_DELLECSADDR:
327 if (!capable(CAP_NET_ADMIN)) { 330 if (!capable(CAP_NET_ADMIN)) {
328 error = -EPERM; 331 error = -EPERM;
329 goto done; 332 goto done;
@@ -335,14 +338,21 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
335 error = -EFAULT; 338 error = -EFAULT;
336 goto done; 339 goto done;
337 } 340 }
338 if (cmd == ATM_ADDADDR) 341 if (cmd == ATM_ADDADDR || cmd == ATM_ADDLECSADDR)
339 error = atm_add_addr(dev, &addr); 342 error = atm_add_addr(dev, &addr,
343 (cmd == ATM_ADDADDR ?
344 ATM_ADDR_LOCAL : ATM_ADDR_LECS));
340 else 345 else
341 error = atm_del_addr(dev, &addr); 346 error = atm_del_addr(dev, &addr,
347 (cmd == ATM_DELADDR ?
348 ATM_ADDR_LOCAL : ATM_ADDR_LECS));
342 goto done; 349 goto done;
343 } 350 }
344 case ATM_GETADDR: 351 case ATM_GETADDR:
345 error = atm_get_addr(dev, buf, len); 352 case ATM_GETLECSADDR:
353 error = atm_get_addr(dev, buf, len,
354 (cmd == ATM_GETADDR ?
355 ATM_ADDR_LOCAL : ATM_ADDR_LECS));
346 if (error < 0) 356 if (error < 0)
347 goto done; 357 goto done;
348 size = error; 358 size = error;
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 810c9c76c2e0..73cfc3411c46 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -123,7 +123,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
123 } 123 }
124 124
125 skb_pull(skb, 1); /* Remove PID */ 125 skb_pull(skb, 1); /* Remove PID */
126 skb->h.raw = skb->data; 126 skb->mac.raw = skb->nh.raw;
127 skb->nh.raw = skb->data; 127 skb->nh.raw = skb->data;
128 skb->dev = ax25->ax25_dev->dev; 128 skb->dev = ax25->ax25_dev->dev;
129 skb->pkt_type = PACKET_HOST; 129 skb->pkt_type = PACKET_HOST;
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index d3d6bc547212..59b2dd36baa7 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -372,7 +372,7 @@ static struct proto l2cap_proto = {
372 .obj_size = sizeof(struct l2cap_pinfo) 372 .obj_size = sizeof(struct l2cap_pinfo)
373}; 373};
374 374
375static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) 375static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, gfp_t prio)
376{ 376{
377 struct sock *sk; 377 struct sock *sk;
378 378
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 173f46e8cdae..35adce6482b6 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -229,7 +229,7 @@ static void rfcomm_dlc_clear_state(struct rfcomm_dlc *d)
229 d->rx_credits = RFCOMM_DEFAULT_CREDITS; 229 d->rx_credits = RFCOMM_DEFAULT_CREDITS;
230} 230}
231 231
232struct rfcomm_dlc *rfcomm_dlc_alloc(unsigned int __nocast prio) 232struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio)
233{ 233{
234 struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio); 234 struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio);
235 if (!d) 235 if (!d)
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index f49e7e938bfb..a2b30f0aedb7 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -284,7 +284,7 @@ static struct proto rfcomm_proto = {
284 .obj_size = sizeof(struct rfcomm_pinfo) 284 .obj_size = sizeof(struct rfcomm_pinfo)
285}; 285};
286 286
287static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) 287static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, gfp_t prio)
288{ 288{
289 struct rfcomm_dlc *d; 289 struct rfcomm_dlc *d;
290 struct sock *sk; 290 struct sock *sk;
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 1bca860a6109..158a9c46d863 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -286,7 +286,7 @@ static inline void rfcomm_set_owner_w(struct sk_buff *skb, struct rfcomm_dev *de
286 skb->destructor = rfcomm_wfree; 286 skb->destructor = rfcomm_wfree;
287} 287}
288 288
289static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, unsigned int __nocast priority) 289static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, gfp_t priority)
290{ 290{
291 if (atomic_read(&dev->wmem_alloc) < rfcomm_room(dev->dlc)) { 291 if (atomic_read(&dev->wmem_alloc) < rfcomm_room(dev->dlc)) {
292 struct sk_buff *skb = alloc_skb(size, priority); 292 struct sk_buff *skb = alloc_skb(size, priority);
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index ce7ab7dfa0b2..997e42df115c 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -418,7 +418,7 @@ static struct proto sco_proto = {
418 .obj_size = sizeof(struct sco_pinfo) 418 .obj_size = sizeof(struct sco_pinfo)
419}; 419};
420 420
421static struct sock *sco_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) 421static struct sock *sco_sock_alloc(struct socket *sock, int proto, gfp_t prio)
422{ 422{
423 struct sock *sk; 423 struct sock *sk;
424 424
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 91bb895375f4..defcf6a8607c 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -79,7 +79,6 @@ static void destroy_nbp(struct net_bridge_port *p)
79{ 79{
80 struct net_device *dev = p->dev; 80 struct net_device *dev = p->dev;
81 81
82 dev->br_port = NULL;
83 p->br = NULL; 82 p->br = NULL;
84 p->dev = NULL; 83 p->dev = NULL;
85 dev_put(dev); 84 dev_put(dev);
@@ -100,6 +99,7 @@ static void del_nbp(struct net_bridge_port *p)
100 struct net_bridge *br = p->br; 99 struct net_bridge *br = p->br;
101 struct net_device *dev = p->dev; 100 struct net_device *dev = p->dev;
102 101
102 dev->br_port = NULL;
103 dev_set_promiscuity(dev, -1); 103 dev_set_promiscuity(dev, -1);
104 104
105 spin_lock_bh(&br->lock); 105 spin_lock_bh(&br->lock);
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index c4540144f0f4..f8ffbf6e2333 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -26,6 +26,7 @@
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <linux/smp.h> 28#include <linux/smp.h>
29#include <linux/cpumask.h>
29#include <net/sock.h> 30#include <net/sock.h>
30/* needed for logical [in,out]-dev filtering */ 31/* needed for logical [in,out]-dev filtering */
31#include "../br_private.h" 32#include "../br_private.h"
@@ -823,10 +824,11 @@ static int translate_table(struct ebt_replace *repl,
823 /* this will get free'd in do_replace()/ebt_register_table() 824 /* this will get free'd in do_replace()/ebt_register_table()
824 if an error occurs */ 825 if an error occurs */
825 newinfo->chainstack = (struct ebt_chainstack **) 826 newinfo->chainstack = (struct ebt_chainstack **)
826 vmalloc(num_possible_cpus() * sizeof(struct ebt_chainstack)); 827 vmalloc((highest_possible_processor_id()+1)
828 * sizeof(struct ebt_chainstack));
827 if (!newinfo->chainstack) 829 if (!newinfo->chainstack)
828 return -ENOMEM; 830 return -ENOMEM;
829 for (i = 0; i < num_possible_cpus(); i++) { 831 for_each_cpu(i) {
830 newinfo->chainstack[i] = 832 newinfo->chainstack[i] =
831 vmalloc(udc_cnt * sizeof(struct ebt_chainstack)); 833 vmalloc(udc_cnt * sizeof(struct ebt_chainstack));
832 if (!newinfo->chainstack[i]) { 834 if (!newinfo->chainstack[i]) {
@@ -895,9 +897,12 @@ static void get_counters(struct ebt_counter *oldcounters,
895 897
896 /* counters of cpu 0 */ 898 /* counters of cpu 0 */
897 memcpy(counters, oldcounters, 899 memcpy(counters, oldcounters,
898 sizeof(struct ebt_counter) * nentries); 900 sizeof(struct ebt_counter) * nentries);
901
899 /* add other counters to those of cpu 0 */ 902 /* add other counters to those of cpu 0 */
900 for (cpu = 1; cpu < num_possible_cpus(); cpu++) { 903 for_each_cpu(cpu) {
904 if (cpu == 0)
905 continue;
901 counter_base = COUNTER_BASE(oldcounters, nentries, cpu); 906 counter_base = COUNTER_BASE(oldcounters, nentries, cpu);
902 for (i = 0; i < nentries; i++) { 907 for (i = 0; i < nentries; i++) {
903 counters[i].pcnt += counter_base[i].pcnt; 908 counters[i].pcnt += counter_base[i].pcnt;
@@ -929,7 +934,8 @@ static int do_replace(void __user *user, unsigned int len)
929 BUGPRINT("Entries_size never zero\n"); 934 BUGPRINT("Entries_size never zero\n");
930 return -EINVAL; 935 return -EINVAL;
931 } 936 }
932 countersize = COUNTER_OFFSET(tmp.nentries) * num_possible_cpus(); 937 countersize = COUNTER_OFFSET(tmp.nentries) *
938 (highest_possible_processor_id()+1);
933 newinfo = (struct ebt_table_info *) 939 newinfo = (struct ebt_table_info *)
934 vmalloc(sizeof(struct ebt_table_info) + countersize); 940 vmalloc(sizeof(struct ebt_table_info) + countersize);
935 if (!newinfo) 941 if (!newinfo)
@@ -1022,7 +1028,7 @@ static int do_replace(void __user *user, unsigned int len)
1022 1028
1023 vfree(table->entries); 1029 vfree(table->entries);
1024 if (table->chainstack) { 1030 if (table->chainstack) {
1025 for (i = 0; i < num_possible_cpus(); i++) 1031 for_each_cpu(i)
1026 vfree(table->chainstack[i]); 1032 vfree(table->chainstack[i]);
1027 vfree(table->chainstack); 1033 vfree(table->chainstack);
1028 } 1034 }
@@ -1040,7 +1046,7 @@ free_counterstmp:
1040 vfree(counterstmp); 1046 vfree(counterstmp);
1041 /* can be initialized in translate_table() */ 1047 /* can be initialized in translate_table() */
1042 if (newinfo->chainstack) { 1048 if (newinfo->chainstack) {
1043 for (i = 0; i < num_possible_cpus(); i++) 1049 for_each_cpu(i)
1044 vfree(newinfo->chainstack[i]); 1050 vfree(newinfo->chainstack[i]);
1045 vfree(newinfo->chainstack); 1051 vfree(newinfo->chainstack);
1046 } 1052 }
@@ -1132,7 +1138,8 @@ int ebt_register_table(struct ebt_table *table)
1132 return -EINVAL; 1138 return -EINVAL;
1133 } 1139 }
1134 1140
1135 countersize = COUNTER_OFFSET(table->table->nentries) * num_possible_cpus(); 1141 countersize = COUNTER_OFFSET(table->table->nentries) *
1142 (highest_possible_processor_id()+1);
1136 newinfo = (struct ebt_table_info *) 1143 newinfo = (struct ebt_table_info *)
1137 vmalloc(sizeof(struct ebt_table_info) + countersize); 1144 vmalloc(sizeof(struct ebt_table_info) + countersize);
1138 ret = -ENOMEM; 1145 ret = -ENOMEM;
@@ -1186,7 +1193,7 @@ free_unlock:
1186 up(&ebt_mutex); 1193 up(&ebt_mutex);
1187free_chainstack: 1194free_chainstack:
1188 if (newinfo->chainstack) { 1195 if (newinfo->chainstack) {
1189 for (i = 0; i < num_possible_cpus(); i++) 1196 for_each_cpu(i)
1190 vfree(newinfo->chainstack[i]); 1197 vfree(newinfo->chainstack[i]);
1191 vfree(newinfo->chainstack); 1198 vfree(newinfo->chainstack);
1192 } 1199 }
@@ -1209,7 +1216,7 @@ void ebt_unregister_table(struct ebt_table *table)
1209 up(&ebt_mutex); 1216 up(&ebt_mutex);
1210 vfree(table->private->entries); 1217 vfree(table->private->entries);
1211 if (table->private->chainstack) { 1218 if (table->private->chainstack) {
1212 for (i = 0; i < num_possible_cpus(); i++) 1219 for_each_cpu(i)
1213 vfree(table->private->chainstack[i]); 1220 vfree(table->private->chainstack[i]);
1214 vfree(table->private->chainstack); 1221 vfree(table->private->chainstack);
1215 } 1222 }
diff --git a/net/core/dev.c b/net/core/dev.c
index 9066c874e273..a44eeef24edf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1132,7 +1132,7 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
1132#endif 1132#endif
1133 1133
1134/* Keep head the same: replace data */ 1134/* Keep head the same: replace data */
1135int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp_mask) 1135int __skb_linearize(struct sk_buff *skb, gfp_t gfp_mask)
1136{ 1136{
1137 unsigned int size; 1137 unsigned int size;
1138 u8 *data; 1138 u8 *data;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 0e9431b59fb2..af9b1516e21f 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -130,7 +130,7 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here)
130 * Buffers may only be allocated from interrupts using a @gfp_mask of 130 * Buffers may only be allocated from interrupts using a @gfp_mask of
131 * %GFP_ATOMIC. 131 * %GFP_ATOMIC.
132 */ 132 */
133struct sk_buff *__alloc_skb(unsigned int size, unsigned int __nocast gfp_mask, 133struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
134 int fclone) 134 int fclone)
135{ 135{
136 struct sk_buff *skb; 136 struct sk_buff *skb;
@@ -198,7 +198,7 @@ nodata:
198 */ 198 */
199struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, 199struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
200 unsigned int size, 200 unsigned int size,
201 unsigned int __nocast gfp_mask) 201 gfp_t gfp_mask)
202{ 202{
203 struct sk_buff *skb; 203 struct sk_buff *skb;
204 u8 *data; 204 u8 *data;
@@ -361,7 +361,7 @@ void __kfree_skb(struct sk_buff *skb)
361 * %GFP_ATOMIC. 361 * %GFP_ATOMIC.
362 */ 362 */
363 363
364struct sk_buff *skb_clone(struct sk_buff *skb, unsigned int __nocast gfp_mask) 364struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
365{ 365{
366 struct sk_buff *n; 366 struct sk_buff *n;
367 367
@@ -500,7 +500,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
500 * header is going to be modified. Use pskb_copy() instead. 500 * header is going to be modified. Use pskb_copy() instead.
501 */ 501 */
502 502
503struct sk_buff *skb_copy(const struct sk_buff *skb, unsigned int __nocast gfp_mask) 503struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
504{ 504{
505 int headerlen = skb->data - skb->head; 505 int headerlen = skb->data - skb->head;
506 /* 506 /*
@@ -539,7 +539,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, unsigned int __nocast gfp_ma
539 * The returned buffer has a reference count of 1. 539 * The returned buffer has a reference count of 1.
540 */ 540 */
541 541
542struct sk_buff *pskb_copy(struct sk_buff *skb, unsigned int __nocast gfp_mask) 542struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask)
543{ 543{
544 /* 544 /*
545 * Allocate the copy buffer 545 * Allocate the copy buffer
@@ -598,7 +598,7 @@ out:
598 */ 598 */
599 599
600int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, 600int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
601 unsigned int __nocast gfp_mask) 601 gfp_t gfp_mask)
602{ 602{
603 int i; 603 int i;
604 u8 *data; 604 u8 *data;
@@ -689,7 +689,7 @@ struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom)
689 */ 689 */
690struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 690struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
691 int newheadroom, int newtailroom, 691 int newheadroom, int newtailroom,
692 unsigned int __nocast gfp_mask) 692 gfp_t gfp_mask)
693{ 693{
694 /* 694 /*
695 * Allocate the copy buffer 695 * Allocate the copy buffer
diff --git a/net/core/sock.c b/net/core/sock.c
index 928d2a1d6d8e..1c52fe809eda 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -637,7 +637,7 @@ lenout:
637 * @prot: struct proto associated with this new sock instance 637 * @prot: struct proto associated with this new sock instance
638 * @zero_it: if we should zero the newly allocated sock 638 * @zero_it: if we should zero the newly allocated sock
639 */ 639 */
640struct sock *sk_alloc(int family, unsigned int __nocast priority, 640struct sock *sk_alloc(int family, gfp_t priority,
641 struct proto *prot, int zero_it) 641 struct proto *prot, int zero_it)
642{ 642{
643 struct sock *sk = NULL; 643 struct sock *sk = NULL;
@@ -704,7 +704,7 @@ void sk_free(struct sock *sk)
704 module_put(owner); 704 module_put(owner);
705} 705}
706 706
707struct sock *sk_clone(const struct sock *sk, const unsigned int __nocast priority) 707struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
708{ 708{
709 struct sock *newsk = sk_alloc(sk->sk_family, priority, sk->sk_prot, 0); 709 struct sock *newsk = sk_alloc(sk->sk_family, priority, sk->sk_prot, 0);
710 710
@@ -845,7 +845,7 @@ unsigned long sock_i_ino(struct sock *sk)
845 * Allocate a skb from the socket's send buffer. 845 * Allocate a skb from the socket's send buffer.
846 */ 846 */
847struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, 847struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
848 unsigned int __nocast priority) 848 gfp_t priority)
849{ 849{
850 if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) { 850 if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
851 struct sk_buff * skb = alloc_skb(size, priority); 851 struct sk_buff * skb = alloc_skb(size, priority);
@@ -861,7 +861,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
861 * Allocate a skb from the socket's receive buffer. 861 * Allocate a skb from the socket's receive buffer.
862 */ 862 */
863struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, 863struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
864 unsigned int __nocast priority) 864 gfp_t priority)
865{ 865{
866 if (force || atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf) { 866 if (force || atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf) {
867 struct sk_buff *skb = alloc_skb(size, priority); 867 struct sk_buff *skb = alloc_skb(size, priority);
@@ -876,7 +876,7 @@ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
876/* 876/*
877 * Allocate a memory block from the socket's option memory buffer. 877 * Allocate a memory block from the socket's option memory buffer.
878 */ 878 */
879void *sock_kmalloc(struct sock *sk, int size, unsigned int __nocast priority) 879void *sock_kmalloc(struct sock *sk, int size, gfp_t priority)
880{ 880{
881 if ((unsigned)size <= sysctl_optmem_max && 881 if ((unsigned)size <= sysctl_optmem_max &&
882 atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) { 882 atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) {
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c
index 6530283eafca..c9a62cca22fc 100644
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -91,7 +91,7 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb)
91} 91}
92 92
93struct dccp_ackvec *dccp_ackvec_alloc(const unsigned int len, 93struct dccp_ackvec *dccp_ackvec_alloc(const unsigned int len,
94 const unsigned int __nocast priority) 94 const gfp_t priority)
95{ 95{
96 struct dccp_ackvec *av = kmalloc(sizeof(*av) + len, priority); 96 struct dccp_ackvec *av = kmalloc(sizeof(*av) + len, priority);
97 97
diff --git a/net/dccp/ackvec.h b/net/dccp/ackvec.h
index 8ca51c9191f7..d0fd6c60c574 100644
--- a/net/dccp/ackvec.h
+++ b/net/dccp/ackvec.h
@@ -74,7 +74,7 @@ struct sk_buff;
74 74
75#ifdef CONFIG_IP_DCCP_ACKVEC 75#ifdef CONFIG_IP_DCCP_ACKVEC
76extern struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len, 76extern struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len,
77 const unsigned int __nocast priority); 77 const gfp_t priority);
78extern void dccp_ackvec_free(struct dccp_ackvec *av); 78extern void dccp_ackvec_free(struct dccp_ackvec *av);
79 79
80extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, 80extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
@@ -93,7 +93,7 @@ static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
93} 93}
94#else /* CONFIG_IP_DCCP_ACKVEC */ 94#else /* CONFIG_IP_DCCP_ACKVEC */
95static inline struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len, 95static inline struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len,
96 const unsigned int __nocast priority) 96 const gfp_t priority)
97{ 97{
98 return NULL; 98 return NULL;
99} 99}
diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h
index 21e55142dcd3..c37eeeaf5c6e 100644
--- a/net/dccp/ccid.h
+++ b/net/dccp/ccid.h
@@ -110,14 +110,14 @@ static inline int ccid_hc_tx_init(struct ccid *ccid, struct sock *sk)
110 110
111static inline void ccid_hc_rx_exit(struct ccid *ccid, struct sock *sk) 111static inline void ccid_hc_rx_exit(struct ccid *ccid, struct sock *sk)
112{ 112{
113 if (ccid->ccid_hc_rx_exit != NULL && 113 if (ccid != NULL && ccid->ccid_hc_rx_exit != NULL &&
114 dccp_sk(sk)->dccps_hc_rx_ccid_private != NULL) 114 dccp_sk(sk)->dccps_hc_rx_ccid_private != NULL)
115 ccid->ccid_hc_rx_exit(sk); 115 ccid->ccid_hc_rx_exit(sk);
116} 116}
117 117
118static inline void ccid_hc_tx_exit(struct ccid *ccid, struct sock *sk) 118static inline void ccid_hc_tx_exit(struct ccid *ccid, struct sock *sk)
119{ 119{
120 if (ccid->ccid_hc_tx_exit != NULL && 120 if (ccid != NULL && ccid->ccid_hc_tx_exit != NULL &&
121 dccp_sk(sk)->dccps_hc_tx_ccid_private != NULL) 121 dccp_sk(sk)->dccps_hc_tx_ccid_private != NULL)
122 ccid->ccid_hc_tx_exit(sk); 122 ccid->ccid_hc_tx_exit(sk);
123} 123}
diff --git a/net/dccp/ccids/lib/loss_interval.h b/net/dccp/ccids/lib/loss_interval.h
index 13ad47ba1420..417d9d82df3e 100644
--- a/net/dccp/ccids/lib/loss_interval.h
+++ b/net/dccp/ccids/lib/loss_interval.h
@@ -36,7 +36,7 @@ struct dccp_li_hist_entry {
36 36
37static inline struct dccp_li_hist_entry * 37static inline struct dccp_li_hist_entry *
38 dccp_li_hist_entry_new(struct dccp_li_hist *hist, 38 dccp_li_hist_entry_new(struct dccp_li_hist *hist,
39 const unsigned int __nocast prio) 39 const gfp_t prio)
40{ 40{
41 return kmem_cache_alloc(hist->dccplih_slab, prio); 41 return kmem_cache_alloc(hist->dccplih_slab, prio);
42} 42}
diff --git a/net/dccp/ccids/lib/packet_history.h b/net/dccp/ccids/lib/packet_history.h
index b375ebdb7dcf..122e96737ff6 100644
--- a/net/dccp/ccids/lib/packet_history.h
+++ b/net/dccp/ccids/lib/packet_history.h
@@ -86,7 +86,7 @@ extern struct dccp_rx_hist_entry *
86 86
87static inline struct dccp_tx_hist_entry * 87static inline struct dccp_tx_hist_entry *
88 dccp_tx_hist_entry_new(struct dccp_tx_hist *hist, 88 dccp_tx_hist_entry_new(struct dccp_tx_hist *hist,
89 const unsigned int __nocast prio) 89 const gfp_t prio)
90{ 90{
91 struct dccp_tx_hist_entry *entry = kmem_cache_alloc(hist->dccptxh_slab, 91 struct dccp_tx_hist_entry *entry = kmem_cache_alloc(hist->dccptxh_slab,
92 prio); 92 prio);
@@ -137,7 +137,7 @@ static inline struct dccp_rx_hist_entry *
137 const struct sock *sk, 137 const struct sock *sk,
138 const u32 ndp, 138 const u32 ndp,
139 const struct sk_buff *skb, 139 const struct sk_buff *skb,
140 const unsigned int __nocast prio) 140 const gfp_t prio)
141{ 141{
142 struct dccp_rx_hist_entry *entry = kmem_cache_alloc(hist->dccprxh_slab, 142 struct dccp_rx_hist_entry *entry = kmem_cache_alloc(hist->dccprxh_slab,
143 prio); 143 prio);
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 1b6b2cb12376..3454d5941900 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -375,6 +375,9 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
375 case DCCP_PKT_RESET: 375 case DCCP_PKT_RESET:
376 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); 376 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
377 break; 377 break;
378 case DCCP_PKT_DATA:
379 if (sk->sk_state == DCCP_RESPOND)
380 break;
378 case DCCP_PKT_DATAACK: 381 case DCCP_PKT_DATAACK:
379 case DCCP_PKT_ACK: 382 case DCCP_PKT_ACK:
380 /* 383 /*
@@ -393,7 +396,8 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
393 dccp_sk(sk)->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq; 396 dccp_sk(sk)->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq;
394 dccp_set_state(sk, DCCP_OPEN); 397 dccp_set_state(sk, DCCP_OPEN);
395 398
396 if (dh->dccph_type == DCCP_PKT_DATAACK) { 399 if (dh->dccph_type == DCCP_PKT_DATAACK ||
400 dh->dccph_type == DCCP_PKT_DATA) {
397 dccp_rcv_established(sk, skb, dh, len); 401 dccp_rcv_established(sk, skb, dh, len);
398 queued = 1; /* packet was queued 402 queued = 1; /* packet was queued
399 (by dccp_rcv_established) */ 403 (by dccp_rcv_established) */
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 348f36b529f7..1186dc44cdff 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -452,7 +452,7 @@ static struct proto dn_proto = {
452 .obj_size = sizeof(struct dn_sock), 452 .obj_size = sizeof(struct dn_sock),
453}; 453};
454 454
455static struct sock *dn_alloc_sock(struct socket *sock, int gfp) 455static struct sock *dn_alloc_sock(struct socket *sock, gfp_t gfp)
456{ 456{
457 struct dn_scp *scp; 457 struct dn_scp *scp;
458 struct sock *sk = sk_alloc(PF_DECnet, gfp, &dn_proto, 1); 458 struct sock *sk = sk_alloc(PF_DECnet, gfp, &dn_proto, 1);
@@ -804,7 +804,7 @@ static int dn_auto_bind(struct socket *sock)
804 return rv; 804 return rv;
805} 805}
806 806
807static int dn_confirm_accept(struct sock *sk, long *timeo, int allocation) 807static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
808{ 808{
809 struct dn_scp *scp = DN_SK(sk); 809 struct dn_scp *scp = DN_SK(sk);
810 DEFINE_WAIT(wait); 810 DEFINE_WAIT(wait);
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index 53633d352868..c96c767b1f74 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -117,7 +117,7 @@ try_again:
117 * The eventual aim is for each socket to have a cached header size 117 * The eventual aim is for each socket to have a cached header size
118 * for its outgoing packets, and to set hdr from this when sk != NULL. 118 * for its outgoing packets, and to set hdr from this when sk != NULL.
119 */ 119 */
120struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri) 120struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri)
121{ 121{
122 struct sk_buff *skb; 122 struct sk_buff *skb;
123 int hdr = 64; 123 int hdr = 64;
@@ -210,7 +210,8 @@ static void dn_nsp_rtt(struct sock *sk, long rtt)
210 * 210 *
211 * Returns: The number of times the packet has been sent previously 211 * Returns: The number of times the packet has been sent previously
212 */ 212 */
213static inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb, int gfp) 213static inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb,
214 gfp_t gfp)
214{ 215{
215 struct dn_skb_cb *cb = DN_SKB_CB(skb); 216 struct dn_skb_cb *cb = DN_SKB_CB(skb);
216 struct sk_buff *skb2; 217 struct sk_buff *skb2;
@@ -350,7 +351,8 @@ static unsigned short *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *sk
350 return ptr; 351 return ptr;
351} 352}
352 353
353void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, int gfp, int oth) 354void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb,
355 gfp_t gfp, int oth)
354{ 356{
355 struct dn_scp *scp = DN_SK(sk); 357 struct dn_scp *scp = DN_SK(sk);
356 struct dn_skb_cb *cb = DN_SKB_CB(skb); 358 struct dn_skb_cb *cb = DN_SKB_CB(skb);
@@ -517,7 +519,7 @@ static int dn_nsp_retrans_conn_conf(struct sock *sk)
517 return 0; 519 return 0;
518} 520}
519 521
520void dn_send_conn_conf(struct sock *sk, int gfp) 522void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
521{ 523{
522 struct dn_scp *scp = DN_SK(sk); 524 struct dn_scp *scp = DN_SK(sk);
523 struct sk_buff *skb = NULL; 525 struct sk_buff *skb = NULL;
@@ -549,7 +551,8 @@ void dn_send_conn_conf(struct sock *sk, int gfp)
549 551
550 552
551static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, 553static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
552 unsigned short reason, int gfp, struct dst_entry *dst, 554 unsigned short reason, gfp_t gfp,
555 struct dst_entry *dst,
553 int ddl, unsigned char *dd, __u16 rem, __u16 loc) 556 int ddl, unsigned char *dd, __u16 rem, __u16 loc)
554{ 557{
555 struct sk_buff *skb = NULL; 558 struct sk_buff *skb = NULL;
@@ -591,7 +594,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
591 594
592 595
593void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, 596void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg,
594 unsigned short reason, int gfp) 597 unsigned short reason, gfp_t gfp)
595{ 598{
596 struct dn_scp *scp = DN_SK(sk); 599 struct dn_scp *scp = DN_SK(sk);
597 int ddl = 0; 600 int ddl = 0;
@@ -612,7 +615,7 @@ void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg,
612{ 615{
613 struct dn_skb_cb *cb = DN_SKB_CB(skb); 616 struct dn_skb_cb *cb = DN_SKB_CB(skb);
614 int ddl = 0; 617 int ddl = 0;
615 int gfp = GFP_ATOMIC; 618 gfp_t gfp = GFP_ATOMIC;
616 619
617 dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl, 620 dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl,
618 NULL, cb->src_port, cb->dst_port); 621 NULL, cb->src_port, cb->dst_port);
@@ -624,7 +627,7 @@ void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval)
624 struct dn_scp *scp = DN_SK(sk); 627 struct dn_scp *scp = DN_SK(sk);
625 struct sk_buff *skb; 628 struct sk_buff *skb;
626 unsigned char *ptr; 629 unsigned char *ptr;
627 int gfp = GFP_ATOMIC; 630 gfp_t gfp = GFP_ATOMIC;
628 631
629 if ((skb = dn_alloc_skb(sk, DN_MAX_NSP_DATA_HEADER + 2, gfp)) == NULL) 632 if ((skb = dn_alloc_skb(sk, DN_MAX_NSP_DATA_HEADER + 2, gfp)) == NULL)
630 return; 633 return;
@@ -659,7 +662,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
659 unsigned char menuver; 662 unsigned char menuver;
660 struct dn_skb_cb *cb; 663 struct dn_skb_cb *cb;
661 unsigned char type = 1; 664 unsigned char type = 1;
662 int allocation = (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC; 665 gfp_t allocation = (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC;
663 struct sk_buff *skb = dn_alloc_skb(sk, 200, allocation); 666 struct sk_buff *skb = dn_alloc_skb(sk, 200, allocation);
664 667
665 if (!skb) 668 if (!skb)
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
index 4644338ac571..42c50619aa8e 100644
--- a/net/ieee80211/ieee80211_tx.c
+++ b/net/ieee80211/ieee80211_tx.c
@@ -187,7 +187,7 @@ void ieee80211_txb_free(struct ieee80211_txb *txb)
187} 187}
188 188
189static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, 189static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
190 unsigned int __nocast gfp_mask) 190 gfp_t gfp_mask)
191{ 191{
192 struct ieee80211_txb *txb; 192 struct ieee80211_txb *txb;
193 int i; 193 int i;
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 1b5a09d1b90b..1b18ce66e7b7 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -5,6 +5,7 @@
5#include <net/esp.h> 5#include <net/esp.h>
6#include <asm/scatterlist.h> 6#include <asm/scatterlist.h>
7#include <linux/crypto.h> 7#include <linux/crypto.h>
8#include <linux/kernel.h>
8#include <linux/pfkeyv2.h> 9#include <linux/pfkeyv2.h>
9#include <linux/random.h> 10#include <linux/random.h>
10#include <net/icmp.h> 11#include <net/icmp.h>
@@ -42,10 +43,10 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
42 esp = x->data; 43 esp = x->data;
43 alen = esp->auth.icv_trunc_len; 44 alen = esp->auth.icv_trunc_len;
44 tfm = esp->conf.tfm; 45 tfm = esp->conf.tfm;
45 blksize = (crypto_tfm_alg_blocksize(tfm) + 3) & ~3; 46 blksize = ALIGN(crypto_tfm_alg_blocksize(tfm), 4);
46 clen = (clen + 2 + blksize-1)&~(blksize-1); 47 clen = ALIGN(clen + 2, blksize);
47 if (esp->conf.padlen) 48 if (esp->conf.padlen)
48 clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1); 49 clen = ALIGN(clen, esp->conf.padlen);
49 50
50 if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) 51 if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0)
51 goto error; 52 goto error;
@@ -143,7 +144,7 @@ static int esp_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struc
143 struct ip_esp_hdr *esph; 144 struct ip_esp_hdr *esph;
144 struct esp_data *esp = x->data; 145 struct esp_data *esp = x->data;
145 struct sk_buff *trailer; 146 struct sk_buff *trailer;
146 int blksize = crypto_tfm_alg_blocksize(esp->conf.tfm); 147 int blksize = ALIGN(crypto_tfm_alg_blocksize(esp->conf.tfm), 4);
147 int alen = esp->auth.icv_trunc_len; 148 int alen = esp->auth.icv_trunc_len;
148 int elen = skb->len - sizeof(struct ip_esp_hdr) - esp->conf.ivlen - alen; 149 int elen = skb->len - sizeof(struct ip_esp_hdr) - esp->conf.ivlen - alen;
149 int nfrags; 150 int nfrags;
@@ -304,16 +305,16 @@ static int esp_post_input(struct xfrm_state *x, struct xfrm_decap_state *decap,
304static u32 esp4_get_max_size(struct xfrm_state *x, int mtu) 305static u32 esp4_get_max_size(struct xfrm_state *x, int mtu)
305{ 306{
306 struct esp_data *esp = x->data; 307 struct esp_data *esp = x->data;
307 u32 blksize = crypto_tfm_alg_blocksize(esp->conf.tfm); 308 u32 blksize = ALIGN(crypto_tfm_alg_blocksize(esp->conf.tfm), 4);
308 309
309 if (x->props.mode) { 310 if (x->props.mode) {
310 mtu = (mtu + 2 + blksize-1)&~(blksize-1); 311 mtu = ALIGN(mtu + 2, blksize);
311 } else { 312 } else {
312 /* The worst case. */ 313 /* The worst case. */
313 mtu += 2 + blksize; 314 mtu = ALIGN(mtu + 2, 4) + blksize - 4;
314 } 315 }
315 if (esp->conf.padlen) 316 if (esp->conf.padlen)
316 mtu = (mtu + esp->conf.padlen-1)&~(esp->conf.padlen-1); 317 mtu = ALIGN(mtu, esp->conf.padlen);
317 318
318 return mtu + x->props.header_len + esp->auth.icv_trunc_len; 319 return mtu + x->props.header_len + esp->auth.icv_trunc_len;
319} 320}
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index fe3c6d3d0c91..94468a76c5b4 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -494,7 +494,7 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
494EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_prune); 494EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_prune);
495 495
496struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req, 496struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req,
497 const unsigned int __nocast priority) 497 const gfp_t priority)
498{ 498{
499 struct sock *newsk = sk_clone(sk, priority); 499 struct sock *newsk = sk_clone(sk, priority);
500 500
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index f9076ef3a1a8..a010e9a68811 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -111,6 +111,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, const int stat
111 tw->tw_prot = sk->sk_prot_creator; 111 tw->tw_prot = sk->sk_prot_creator;
112 atomic_set(&tw->tw_refcnt, 1); 112 atomic_set(&tw->tw_refcnt, 1);
113 inet_twsk_dead_node_init(tw); 113 inet_twsk_dead_node_init(tw);
114 __module_get(tw->tw_prot->owner);
114 } 115 }
115 116
116 return tw; 117 return tw;
diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c
index 6e092dadb388..fc6f95aaa969 100644
--- a/net/ipv4/ipvs/ip_vs_app.c
+++ b/net/ipv4/ipvs/ip_vs_app.c
@@ -604,7 +604,7 @@ static struct file_operations ip_vs_app_fops = {
604/* 604/*
605 * Replace a segment of data with a new segment 605 * Replace a segment of data with a new segment
606 */ 606 */
607int ip_vs_skb_replace(struct sk_buff *skb, int pri, 607int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri,
608 char *o_buf, int o_len, char *n_buf, int n_len) 608 char *o_buf, int o_len, char *n_buf, int n_len)
609{ 609{
610 struct iphdr *iph; 610 struct iphdr *iph;
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 2cd7e7d1ac90..7d917e4ce1d9 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -139,9 +139,10 @@ config IP_NF_AMANDA
139 139
140config IP_NF_PPTP 140config IP_NF_PPTP
141 tristate 'PPTP protocol support' 141 tristate 'PPTP protocol support'
142 depends on IP_NF_CONNTRACK
142 help 143 help
143 This module adds support for PPTP (Point to Point Tunnelling 144 This module adds support for PPTP (Point to Point Tunnelling
144 Protocol, RFC2637) conncection tracking and NAT. 145 Protocol, RFC2637) connection tracking and NAT.
145 146
146 If you are running PPTP sessions over a stateful firewall or NAT 147 If you are running PPTP sessions over a stateful firewall or NAT
147 box, you may want to enable this feature. 148 box, you may want to enable this feature.
@@ -498,9 +499,14 @@ config IP_NF_TARGET_LOG
498 To compile it as a module, choose M here. If unsure, say N. 499 To compile it as a module, choose M here. If unsure, say N.
499 500
500config IP_NF_TARGET_ULOG 501config IP_NF_TARGET_ULOG
501 tristate "ULOG target support" 502 tristate "ULOG target support (OBSOLETE)"
502 depends on IP_NF_IPTABLES 503 depends on IP_NF_IPTABLES
503 ---help--- 504 ---help---
505
506 This option enables the old IPv4-only "ipt_ULOG" implementation
507 which has been obsoleted by the new "nfnetlink_log" code (see
508 CONFIG_NETFILTER_NETLINK_LOG).
509
504 This option adds a `ULOG' target, which allows you to create rules in 510 This option adds a `ULOG' target, which allows you to create rules in
505 any iptables table. The packet is passed to a userspace logging 511 any iptables table. The packet is passed to a userspace logging
506 daemon using netlink multicast sockets; unlike the LOG target 512 daemon using netlink multicast sockets; unlike the LOG target
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index fa1634256680..a7969286e6e7 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -716,8 +716,10 @@ static int translate_table(const char *name,
716 } 716 }
717 717
718 /* And one copy for every other CPU */ 718 /* And one copy for every other CPU */
719 for (i = 1; i < num_possible_cpus(); i++) { 719 for_each_cpu(i) {
720 memcpy(newinfo->entries + SMP_ALIGN(newinfo->size)*i, 720 if (i == 0)
721 continue;
722 memcpy(newinfo->entries + SMP_ALIGN(newinfo->size) * i,
721 newinfo->entries, 723 newinfo->entries,
722 SMP_ALIGN(newinfo->size)); 724 SMP_ALIGN(newinfo->size));
723 } 725 }
@@ -767,7 +769,7 @@ static void get_counters(const struct arpt_table_info *t,
767 unsigned int cpu; 769 unsigned int cpu;
768 unsigned int i; 770 unsigned int i;
769 771
770 for (cpu = 0; cpu < num_possible_cpus(); cpu++) { 772 for_each_cpu(cpu) {
771 i = 0; 773 i = 0;
772 ARPT_ENTRY_ITERATE(t->entries + TABLE_OFFSET(t, cpu), 774 ARPT_ENTRY_ITERATE(t->entries + TABLE_OFFSET(t, cpu),
773 t->size, 775 t->size,
@@ -885,7 +887,8 @@ static int do_replace(void __user *user, unsigned int len)
885 return -ENOMEM; 887 return -ENOMEM;
886 888
887 newinfo = vmalloc(sizeof(struct arpt_table_info) 889 newinfo = vmalloc(sizeof(struct arpt_table_info)
888 + SMP_ALIGN(tmp.size) * num_possible_cpus()); 890 + SMP_ALIGN(tmp.size) *
891 (highest_possible_processor_id()+1));
889 if (!newinfo) 892 if (!newinfo)
890 return -ENOMEM; 893 return -ENOMEM;
891 894
@@ -1158,7 +1161,8 @@ int arpt_register_table(struct arpt_table *table,
1158 = { 0, 0, 0, { 0 }, { 0 }, { } }; 1161 = { 0, 0, 0, { 0 }, { 0 }, { } };
1159 1162
1160 newinfo = vmalloc(sizeof(struct arpt_table_info) 1163 newinfo = vmalloc(sizeof(struct arpt_table_info)
1161 + SMP_ALIGN(repl->size) * num_possible_cpus()); 1164 + SMP_ALIGN(repl->size) *
1165 (highest_possible_processor_id()+1));
1162 if (!newinfo) { 1166 if (!newinfo) {
1163 ret = -ENOMEM; 1167 ret = -ENOMEM;
1164 return ret; 1168 return ret;
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
index ea65dd3e517a..07a80b56e8dc 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -1119,7 +1119,7 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct,
1119 unsigned long extra_jiffies, 1119 unsigned long extra_jiffies,
1120 int do_acct) 1120 int do_acct)
1121{ 1121{
1122 int do_event = 0; 1122 int event = 0;
1123 1123
1124 IP_NF_ASSERT(ct->timeout.data == (unsigned long)ct); 1124 IP_NF_ASSERT(ct->timeout.data == (unsigned long)ct);
1125 IP_NF_ASSERT(skb); 1125 IP_NF_ASSERT(skb);
@@ -1129,13 +1129,13 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct,
1129 /* If not in hash table, timer will not be active yet */ 1129 /* If not in hash table, timer will not be active yet */
1130 if (!is_confirmed(ct)) { 1130 if (!is_confirmed(ct)) {
1131 ct->timeout.expires = extra_jiffies; 1131 ct->timeout.expires = extra_jiffies;
1132 do_event = 1; 1132 event = IPCT_REFRESH;
1133 } else { 1133 } else {
1134 /* Need del_timer for race avoidance (may already be dying). */ 1134 /* Need del_timer for race avoidance (may already be dying). */
1135 if (del_timer(&ct->timeout)) { 1135 if (del_timer(&ct->timeout)) {
1136 ct->timeout.expires = jiffies + extra_jiffies; 1136 ct->timeout.expires = jiffies + extra_jiffies;
1137 add_timer(&ct->timeout); 1137 add_timer(&ct->timeout);
1138 do_event = 1; 1138 event = IPCT_REFRESH;
1139 } 1139 }
1140 } 1140 }
1141 1141
@@ -1144,14 +1144,17 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct,
1144 ct->counters[CTINFO2DIR(ctinfo)].packets++; 1144 ct->counters[CTINFO2DIR(ctinfo)].packets++;
1145 ct->counters[CTINFO2DIR(ctinfo)].bytes += 1145 ct->counters[CTINFO2DIR(ctinfo)].bytes +=
1146 ntohs(skb->nh.iph->tot_len); 1146 ntohs(skb->nh.iph->tot_len);
1147 if ((ct->counters[CTINFO2DIR(ctinfo)].packets & 0x80000000)
1148 || (ct->counters[CTINFO2DIR(ctinfo)].bytes & 0x80000000))
1149 event |= IPCT_COUNTER_FILLING;
1147 } 1150 }
1148#endif 1151#endif
1149 1152
1150 write_unlock_bh(&ip_conntrack_lock); 1153 write_unlock_bh(&ip_conntrack_lock);
1151 1154
1152 /* must be unlocked when calling event cache */ 1155 /* must be unlocked when calling event cache */
1153 if (do_event) 1156 if (event)
1154 ip_conntrack_event_cache(IPCT_REFRESH, skb); 1157 ip_conntrack_event_cache(event, skb);
1155} 1158}
1156 1159
1157#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ 1160#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c
index b08a432efcf8..166e6069f121 100644
--- a/net/ipv4/netfilter/ip_conntrack_netlink.c
+++ b/net/ipv4/netfilter/ip_conntrack_netlink.c
@@ -177,11 +177,11 @@ ctnetlink_dump_counters(struct sk_buff *skb, const struct ip_conntrack *ct,
177 struct nfattr *nest_count = NFA_NEST(skb, type); 177 struct nfattr *nest_count = NFA_NEST(skb, type);
178 u_int64_t tmp; 178 u_int64_t tmp;
179 179
180 tmp = cpu_to_be64(ct->counters[dir].packets); 180 tmp = htonl(ct->counters[dir].packets);
181 NFA_PUT(skb, CTA_COUNTERS_PACKETS, sizeof(u_int64_t), &tmp); 181 NFA_PUT(skb, CTA_COUNTERS32_PACKETS, sizeof(u_int32_t), &tmp);
182 182
183 tmp = cpu_to_be64(ct->counters[dir].bytes); 183 tmp = htonl(ct->counters[dir].bytes);
184 NFA_PUT(skb, CTA_COUNTERS_BYTES, sizeof(u_int64_t), &tmp); 184 NFA_PUT(skb, CTA_COUNTERS32_BYTES, sizeof(u_int32_t), &tmp);
185 185
186 NFA_NEST_END(skb, nest_count); 186 NFA_NEST_END(skb, nest_count);
187 187
@@ -833,7 +833,8 @@ out:
833static inline int 833static inline int
834ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[]) 834ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[])
835{ 835{
836 unsigned long d, status = *(u_int32_t *)NFA_DATA(cda[CTA_STATUS-1]); 836 unsigned long d;
837 unsigned status = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_STATUS-1]));
837 d = ct->status ^ status; 838 d = ct->status ^ status;
838 839
839 if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING)) 840 if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING))
@@ -948,6 +949,31 @@ ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[])
948 return 0; 949 return 0;
949} 950}
950 951
952static inline int
953ctnetlink_change_protoinfo(struct ip_conntrack *ct, struct nfattr *cda[])
954{
955 struct nfattr *tb[CTA_PROTOINFO_MAX], *attr = cda[CTA_PROTOINFO-1];
956 struct ip_conntrack_protocol *proto;
957 u_int16_t npt = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum;
958 int err = 0;
959
960 if (nfattr_parse_nested(tb, CTA_PROTOINFO_MAX, attr) < 0)
961 goto nfattr_failure;
962
963 proto = ip_conntrack_proto_find_get(npt);
964 if (!proto)
965 return -EINVAL;
966
967 if (proto->from_nfattr)
968 err = proto->from_nfattr(tb, ct);
969 ip_conntrack_proto_put(proto);
970
971 return err;
972
973nfattr_failure:
974 return -ENOMEM;
975}
976
951static int 977static int
952ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[]) 978ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[])
953{ 979{
@@ -973,6 +999,12 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[])
973 return err; 999 return err;
974 } 1000 }
975 1001
1002 if (cda[CTA_PROTOINFO-1]) {
1003 err = ctnetlink_change_protoinfo(ct, cda);
1004 if (err < 0)
1005 return err;
1006 }
1007
976 DEBUGP("all done\n"); 1008 DEBUGP("all done\n");
977 return 0; 1009 return 0;
978} 1010}
@@ -1002,6 +1034,12 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
1002 if (err < 0) 1034 if (err < 0)
1003 goto err; 1035 goto err;
1004 1036
1037 if (cda[CTA_PROTOINFO-1]) {
1038 err = ctnetlink_change_protoinfo(ct, cda);
1039 if (err < 0)
1040 return err;
1041 }
1042
1005 ct->helper = ip_conntrack_helper_find_get(rtuple); 1043 ct->helper = ip_conntrack_helper_find_get(rtuple);
1006 1044
1007 add_timer(&ct->timeout); 1045 add_timer(&ct->timeout);
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
index 838d1d69b36e..98f0015dd255 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
@@ -296,8 +296,7 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[],
296 struct ip_conntrack_tuple *tuple) 296 struct ip_conntrack_tuple *tuple)
297{ 297{
298 if (!tb[CTA_PROTO_ICMP_TYPE-1] 298 if (!tb[CTA_PROTO_ICMP_TYPE-1]
299 || !tb[CTA_PROTO_ICMP_CODE-1] 299 || !tb[CTA_PROTO_ICMP_CODE-1])
300 || !tb[CTA_PROTO_ICMP_ID-1])
301 return -1; 300 return -1;
302 301
303 tuple->dst.u.icmp.type = 302 tuple->dst.u.icmp.type =
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
index 121760d6cc50..d6701cafbcc2 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
@@ -341,17 +341,43 @@ static int tcp_print_conntrack(struct seq_file *s,
341static int tcp_to_nfattr(struct sk_buff *skb, struct nfattr *nfa, 341static int tcp_to_nfattr(struct sk_buff *skb, struct nfattr *nfa,
342 const struct ip_conntrack *ct) 342 const struct ip_conntrack *ct)
343{ 343{
344 struct nfattr *nest_parms = NFA_NEST(skb, CTA_PROTOINFO_TCP);
345
344 read_lock_bh(&tcp_lock); 346 read_lock_bh(&tcp_lock);
345 NFA_PUT(skb, CTA_PROTOINFO_TCP_STATE, sizeof(u_int8_t), 347 NFA_PUT(skb, CTA_PROTOINFO_TCP_STATE, sizeof(u_int8_t),
346 &ct->proto.tcp.state); 348 &ct->proto.tcp.state);
347 read_unlock_bh(&tcp_lock); 349 read_unlock_bh(&tcp_lock);
348 350
351 NFA_NEST_END(skb, nest_parms);
352
349 return 0; 353 return 0;
350 354
351nfattr_failure: 355nfattr_failure:
352 read_unlock_bh(&tcp_lock); 356 read_unlock_bh(&tcp_lock);
353 return -1; 357 return -1;
354} 358}
359
360static int nfattr_to_tcp(struct nfattr *cda[], struct ip_conntrack *ct)
361{
362 struct nfattr *attr = cda[CTA_PROTOINFO_TCP-1];
363 struct nfattr *tb[CTA_PROTOINFO_TCP_MAX];
364
365 if (nfattr_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, attr) < 0)
366 goto nfattr_failure;
367
368 if (!tb[CTA_PROTOINFO_TCP_STATE-1])
369 return -EINVAL;
370
371 write_lock_bh(&tcp_lock);
372 ct->proto.tcp.state =
373 *(u_int8_t *)NFA_DATA(tb[CTA_PROTOINFO_TCP_STATE-1]);
374 write_unlock_bh(&tcp_lock);
375
376 return 0;
377
378nfattr_failure:
379 return -1;
380}
355#endif 381#endif
356 382
357static unsigned int get_conntrack_index(const struct tcphdr *tcph) 383static unsigned int get_conntrack_index(const struct tcphdr *tcph)
@@ -1123,6 +1149,7 @@ struct ip_conntrack_protocol ip_conntrack_protocol_tcp =
1123#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ 1149#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \
1124 defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) 1150 defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE)
1125 .to_nfattr = tcp_to_nfattr, 1151 .to_nfattr = tcp_to_nfattr,
1152 .from_nfattr = nfattr_to_tcp,
1126 .tuple_to_nfattr = ip_ct_port_tuple_to_nfattr, 1153 .tuple_to_nfattr = ip_ct_port_tuple_to_nfattr,
1127 .nfattr_to_tuple = ip_ct_port_nfattr_to_tuple, 1154 .nfattr_to_tuple = ip_ct_port_nfattr_to_tuple,
1128#endif 1155#endif
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index eef99a1b5de6..75c27e92f6ab 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -27,6 +27,7 @@
27#include <asm/semaphore.h> 27#include <asm/semaphore.h>
28#include <linux/proc_fs.h> 28#include <linux/proc_fs.h>
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/cpumask.h>
30 31
31#include <linux/netfilter_ipv4/ip_tables.h> 32#include <linux/netfilter_ipv4/ip_tables.h>
32 33
@@ -921,8 +922,10 @@ translate_table(const char *name,
921 } 922 }
922 923
923 /* And one copy for every other CPU */ 924 /* And one copy for every other CPU */
924 for (i = 1; i < num_possible_cpus(); i++) { 925 for_each_cpu(i) {
925 memcpy(newinfo->entries + SMP_ALIGN(newinfo->size)*i, 926 if (i == 0)
927 continue;
928 memcpy(newinfo->entries + SMP_ALIGN(newinfo->size) * i,
926 newinfo->entries, 929 newinfo->entries,
927 SMP_ALIGN(newinfo->size)); 930 SMP_ALIGN(newinfo->size));
928 } 931 }
@@ -943,7 +946,7 @@ replace_table(struct ipt_table *table,
943 struct ipt_entry *table_base; 946 struct ipt_entry *table_base;
944 unsigned int i; 947 unsigned int i;
945 948
946 for (i = 0; i < num_possible_cpus(); i++) { 949 for_each_cpu(i) {
947 table_base = 950 table_base =
948 (void *)newinfo->entries 951 (void *)newinfo->entries
949 + TABLE_OFFSET(newinfo, i); 952 + TABLE_OFFSET(newinfo, i);
@@ -990,7 +993,7 @@ get_counters(const struct ipt_table_info *t,
990 unsigned int cpu; 993 unsigned int cpu;
991 unsigned int i; 994 unsigned int i;
992 995
993 for (cpu = 0; cpu < num_possible_cpus(); cpu++) { 996 for_each_cpu(cpu) {
994 i = 0; 997 i = 0;
995 IPT_ENTRY_ITERATE(t->entries + TABLE_OFFSET(t, cpu), 998 IPT_ENTRY_ITERATE(t->entries + TABLE_OFFSET(t, cpu),
996 t->size, 999 t->size,
@@ -1128,7 +1131,8 @@ do_replace(void __user *user, unsigned int len)
1128 return -ENOMEM; 1131 return -ENOMEM;
1129 1132
1130 newinfo = vmalloc(sizeof(struct ipt_table_info) 1133 newinfo = vmalloc(sizeof(struct ipt_table_info)
1131 + SMP_ALIGN(tmp.size) * num_possible_cpus()); 1134 + SMP_ALIGN(tmp.size) *
1135 (highest_possible_processor_id()+1));
1132 if (!newinfo) 1136 if (!newinfo)
1133 return -ENOMEM; 1137 return -ENOMEM;
1134 1138
@@ -1458,7 +1462,8 @@ int ipt_register_table(struct ipt_table *table, const struct ipt_replace *repl)
1458 = { 0, 0, 0, { 0 }, { 0 }, { } }; 1462 = { 0, 0, 0, { 0 }, { 0 }, { } };
1459 1463
1460 newinfo = vmalloc(sizeof(struct ipt_table_info) 1464 newinfo = vmalloc(sizeof(struct ipt_table_info)
1461 + SMP_ALIGN(repl->size) * num_possible_cpus()); 1465 + SMP_ALIGN(repl->size) *
1466 (highest_possible_processor_id()+1));
1462 if (!newinfo) 1467 if (!newinfo)
1463 return -ENOMEM; 1468 return -ENOMEM;
1464 1469
diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c
index b940346de4e7..6d80e063c187 100644
--- a/net/ipv4/tcp_bic.c
+++ b/net/ipv4/tcp_bic.c
@@ -136,7 +136,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
136 else if (cwnd < ca->last_max_cwnd + max_increment*(BICTCP_B-1)) 136 else if (cwnd < ca->last_max_cwnd + max_increment*(BICTCP_B-1))
137 /* slow start */ 137 /* slow start */
138 ca->cnt = (cwnd * (BICTCP_B-1)) 138 ca->cnt = (cwnd * (BICTCP_B-1))
139 / cwnd-ca->last_max_cwnd; 139 / (cwnd - ca->last_max_cwnd);
140 else 140 else
141 /* linear increase */ 141 /* linear increase */
142 ca->cnt = cwnd / max_increment; 142 ca->cnt = cwnd / max_increment;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index c5b911f9b662..7114031fdc70 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -435,7 +435,16 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
435 int nsize, old_factor; 435 int nsize, old_factor;
436 u16 flags; 436 u16 flags;
437 437
438 BUG_ON(len >= skb->len); 438 if (unlikely(len >= skb->len)) {
439 if (net_ratelimit()) {
440 printk(KERN_DEBUG "TCP: seg_size=%u, mss=%u, seq=%u, "
441 "end_seq=%u, skb->len=%u.\n", len, mss_now,
442 TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq,
443 skb->len);
444 WARN_ON(1);
445 }
446 return 0;
447 }
439 448
440 nsize = skb_headlen(skb) - len; 449 nsize = skb_headlen(skb) - len;
441 if (nsize < 0) 450 if (nsize < 0)
@@ -1610,7 +1619,7 @@ void tcp_send_fin(struct sock *sk)
1610 * was unread data in the receive queue. This behavior is recommended 1619 * was unread data in the receive queue. This behavior is recommended
1611 * by draft-ietf-tcpimpl-prob-03.txt section 3.10. -DaveM 1620 * by draft-ietf-tcpimpl-prob-03.txt section 3.10. -DaveM
1612 */ 1621 */
1613void tcp_send_active_reset(struct sock *sk, unsigned int __nocast priority) 1622void tcp_send_active_reset(struct sock *sk, gfp_t priority)
1614{ 1623{
1615 struct tcp_sock *tp = tcp_sk(sk); 1624 struct tcp_sock *tp = tcp_sk(sk);
1616 struct sk_buff *skb; 1625 struct sk_buff *skb;
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 9b27460f0cc7..40d9a1935ab5 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -31,6 +31,7 @@
31#include <net/esp.h> 31#include <net/esp.h>
32#include <asm/scatterlist.h> 32#include <asm/scatterlist.h>
33#include <linux/crypto.h> 33#include <linux/crypto.h>
34#include <linux/kernel.h>
34#include <linux/pfkeyv2.h> 35#include <linux/pfkeyv2.h>
35#include <linux/random.h> 36#include <linux/random.h>
36#include <net/icmp.h> 37#include <net/icmp.h>
@@ -66,10 +67,10 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
66 67
67 alen = esp->auth.icv_trunc_len; 68 alen = esp->auth.icv_trunc_len;
68 tfm = esp->conf.tfm; 69 tfm = esp->conf.tfm;
69 blksize = (crypto_tfm_alg_blocksize(tfm) + 3) & ~3; 70 blksize = ALIGN(crypto_tfm_alg_blocksize(tfm), 4);
70 clen = (clen + 2 + blksize-1)&~(blksize-1); 71 clen = ALIGN(clen + 2, blksize);
71 if (esp->conf.padlen) 72 if (esp->conf.padlen)
72 clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1); 73 clen = ALIGN(clen, esp->conf.padlen);
73 74
74 if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) { 75 if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) {
75 goto error; 76 goto error;
@@ -133,7 +134,7 @@ static int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, stru
133 struct ipv6_esp_hdr *esph; 134 struct ipv6_esp_hdr *esph;
134 struct esp_data *esp = x->data; 135 struct esp_data *esp = x->data;
135 struct sk_buff *trailer; 136 struct sk_buff *trailer;
136 int blksize = crypto_tfm_alg_blocksize(esp->conf.tfm); 137 int blksize = ALIGN(crypto_tfm_alg_blocksize(esp->conf.tfm), 4);
137 int alen = esp->auth.icv_trunc_len; 138 int alen = esp->auth.icv_trunc_len;
138 int elen = skb->len - sizeof(struct ipv6_esp_hdr) - esp->conf.ivlen - alen; 139 int elen = skb->len - sizeof(struct ipv6_esp_hdr) - esp->conf.ivlen - alen;
139 140
@@ -235,16 +236,17 @@ out_nofree:
235static u32 esp6_get_max_size(struct xfrm_state *x, int mtu) 236static u32 esp6_get_max_size(struct xfrm_state *x, int mtu)
236{ 237{
237 struct esp_data *esp = x->data; 238 struct esp_data *esp = x->data;
238 u32 blksize = crypto_tfm_alg_blocksize(esp->conf.tfm); 239 u32 blksize = ALIGN(crypto_tfm_alg_blocksize(esp->conf.tfm), 4);
239 240
240 if (x->props.mode) { 241 if (x->props.mode) {
241 mtu = (mtu + 2 + blksize-1)&~(blksize-1); 242 mtu = ALIGN(mtu + 2, blksize);
242 } else { 243 } else {
243 /* The worst case. */ 244 /* The worst case. */
244 mtu += 2 + blksize; 245 u32 padsize = ((blksize - 1) & 7) + 1;
246 mtu = ALIGN(mtu + 2, padsize) + blksize - padsize;
245 } 247 }
246 if (esp->conf.padlen) 248 if (esp->conf.padlen)
247 mtu = (mtu + esp->conf.padlen-1)&~(esp->conf.padlen-1); 249 mtu = ALIGN(mtu, esp->conf.padlen);
248 250
249 return mtu + x->props.header_len + esp->auth.icv_full_len; 251 return mtu + x->props.header_len + esp->auth.icv_full_len;
250} 252}
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 519899fb11d5..39a96c768102 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1393,7 +1393,7 @@ static void mld_sendpack(struct sk_buff *skb)
1393 1393
1394static int grec_size(struct ifmcaddr6 *pmc, int type, int gdel, int sdel) 1394static int grec_size(struct ifmcaddr6 *pmc, int type, int gdel, int sdel)
1395{ 1395{
1396 return sizeof(struct mld2_grec) + 4*mld_scount(pmc,type,gdel,sdel); 1396 return sizeof(struct mld2_grec) + 16 * mld_scount(pmc,type,gdel,sdel);
1397} 1397}
1398 1398
1399static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, 1399static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc,
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 555a31347eda..305d9ee6d7db 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1450,7 +1450,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1450 1450
1451static void pndisc_redo(struct sk_buff *skb) 1451static void pndisc_redo(struct sk_buff *skb)
1452{ 1452{
1453 ndisc_rcv(skb); 1453 ndisc_recv_ns(skb);
1454 kfree_skb(skb); 1454 kfree_skb(skb);
1455} 1455}
1456 1456
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 2da514b16d95..b03e90649eb5 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -28,6 +28,7 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/semaphore.h> 29#include <asm/semaphore.h>
30#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
31#include <linux/cpumask.h>
31 32
32#include <linux/netfilter_ipv6/ip6_tables.h> 33#include <linux/netfilter_ipv6/ip6_tables.h>
33 34
@@ -950,8 +951,10 @@ translate_table(const char *name,
950 } 951 }
951 952
952 /* And one copy for every other CPU */ 953 /* And one copy for every other CPU */
953 for (i = 1; i < num_possible_cpus(); i++) { 954 for_each_cpu(i) {
954 memcpy(newinfo->entries + SMP_ALIGN(newinfo->size)*i, 955 if (i == 0)
956 continue;
957 memcpy(newinfo->entries + SMP_ALIGN(newinfo->size) * i,
955 newinfo->entries, 958 newinfo->entries,
956 SMP_ALIGN(newinfo->size)); 959 SMP_ALIGN(newinfo->size));
957 } 960 }
@@ -973,6 +976,7 @@ replace_table(struct ip6t_table *table,
973 unsigned int i; 976 unsigned int i;
974 977
975 for (i = 0; i < num_possible_cpus(); i++) { 978 for (i = 0; i < num_possible_cpus(); i++) {
979 for_each_cpu(i) {
976 table_base = 980 table_base =
977 (void *)newinfo->entries 981 (void *)newinfo->entries
978 + TABLE_OFFSET(newinfo, i); 982 + TABLE_OFFSET(newinfo, i);
@@ -1019,7 +1023,7 @@ get_counters(const struct ip6t_table_info *t,
1019 unsigned int cpu; 1023 unsigned int cpu;
1020 unsigned int i; 1024 unsigned int i;
1021 1025
1022 for (cpu = 0; cpu < num_possible_cpus(); cpu++) { 1026 for_each_cpu(cpu) {
1023 i = 0; 1027 i = 0;
1024 IP6T_ENTRY_ITERATE(t->entries + TABLE_OFFSET(t, cpu), 1028 IP6T_ENTRY_ITERATE(t->entries + TABLE_OFFSET(t, cpu),
1025 t->size, 1029 t->size,
@@ -1153,7 +1157,8 @@ do_replace(void __user *user, unsigned int len)
1153 return -ENOMEM; 1157 return -ENOMEM;
1154 1158
1155 newinfo = vmalloc(sizeof(struct ip6t_table_info) 1159 newinfo = vmalloc(sizeof(struct ip6t_table_info)
1156 + SMP_ALIGN(tmp.size) * num_possible_cpus()); 1160 + SMP_ALIGN(tmp.size) *
1161 (highest_possible_processor_id()+1));
1157 if (!newinfo) 1162 if (!newinfo)
1158 return -ENOMEM; 1163 return -ENOMEM;
1159 1164
@@ -1467,7 +1472,8 @@ int ip6t_register_table(struct ip6t_table *table,
1467 = { 0, 0, 0, { 0 }, { 0 }, { } }; 1472 = { 0, 0, 0, { 0 }, { 0 }, { } };
1468 1473
1469 newinfo = vmalloc(sizeof(struct ip6t_table_info) 1474 newinfo = vmalloc(sizeof(struct ip6t_table_info)
1470 + SMP_ALIGN(repl->size) * num_possible_cpus()); 1475 + SMP_ALIGN(repl->size) *
1476 (highest_possible_processor_id()+1));
1471 if (!newinfo) 1477 if (!newinfo)
1472 return -ENOMEM; 1478 return -ENOMEM;
1473 1479
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 4879743b945a..39031684b65c 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -185,7 +185,7 @@ static int pfkey_release(struct socket *sock)
185} 185}
186 186
187static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2, 187static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,
188 int allocation, struct sock *sk) 188 gfp_t allocation, struct sock *sk)
189{ 189{
190 int err = -ENOBUFS; 190 int err = -ENOBUFS;
191 191
@@ -217,7 +217,7 @@ static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,
217#define BROADCAST_ONE 1 217#define BROADCAST_ONE 1
218#define BROADCAST_REGISTERED 2 218#define BROADCAST_REGISTERED 2
219#define BROADCAST_PROMISC_ONLY 4 219#define BROADCAST_PROMISC_ONLY 4
220static int pfkey_broadcast(struct sk_buff *skb, int allocation, 220static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation,
221 int broadcast_flags, struct sock *one_sk) 221 int broadcast_flags, struct sock *one_sk)
222{ 222{
223 struct sock *sk; 223 struct sock *sk;
@@ -1416,7 +1416,8 @@ static int pfkey_get(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr,
1416 return 0; 1416 return 0;
1417} 1417}
1418 1418
1419static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig, int allocation) 1419static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig,
1420 gfp_t allocation)
1420{ 1421{
1421 struct sk_buff *skb; 1422 struct sk_buff *skb;
1422 struct sadb_msg *hdr; 1423 struct sadb_msg *hdr;
@@ -2153,6 +2154,7 @@ out:
2153 2154
2154static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs) 2155static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)
2155{ 2156{
2157 unsigned int dir;
2156 int err; 2158 int err;
2157 struct sadb_x_policy *pol; 2159 struct sadb_x_policy *pol;
2158 struct xfrm_policy *xp; 2160 struct xfrm_policy *xp;
@@ -2161,7 +2163,11 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2161 if ((pol = ext_hdrs[SADB_X_EXT_POLICY-1]) == NULL) 2163 if ((pol = ext_hdrs[SADB_X_EXT_POLICY-1]) == NULL)
2162 return -EINVAL; 2164 return -EINVAL;
2163 2165
2164 xp = xfrm_policy_byid(0, pol->sadb_x_policy_id, 2166 dir = xfrm_policy_id2dir(pol->sadb_x_policy_id);
2167 if (dir >= XFRM_POLICY_MAX)
2168 return -EINVAL;
2169
2170 xp = xfrm_policy_byid(dir, pol->sadb_x_policy_id,
2165 hdr->sadb_msg_type == SADB_X_SPDDELETE2); 2171 hdr->sadb_msg_type == SADB_X_SPDDELETE2);
2166 if (xp == NULL) 2172 if (xp == NULL)
2167 return -ENOENT; 2173 return -ENOENT;
@@ -2173,9 +2179,9 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2173 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) { 2179 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) {
2174 c.data.byid = 1; 2180 c.data.byid = 1;
2175 c.event = XFRM_MSG_DELPOLICY; 2181 c.event = XFRM_MSG_DELPOLICY;
2176 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c); 2182 km_policy_notify(xp, dir, &c);
2177 } else { 2183 } else {
2178 err = key_pol_get_resp(sk, xp, hdr, pol->sadb_x_policy_dir-1); 2184 err = key_pol_get_resp(sk, xp, hdr, dir);
2179 } 2185 }
2180 2186
2181 xfrm_pol_put(xp); 2187 xfrm_pol_put(xp);
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 042b24a8ca4c..c761c15da421 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -867,8 +867,7 @@ static void llc_sk_init(struct sock* sk)
867 * Allocates a LLC sock and initializes it. Returns the new LLC sock 867 * Allocates a LLC sock and initializes it. Returns the new LLC sock
868 * or %NULL if there's no memory available for one 868 * or %NULL if there's no memory available for one
869 */ 869 */
870struct sock *llc_sk_alloc(int family, unsigned int __nocast priority, 870struct sock *llc_sk_alloc(int family, gfp_t priority, struct proto *prot)
871 struct proto *prot)
872{ 871{
873 struct sock *sk = sk_alloc(family, priority, prot, 1); 872 struct sock *sk = sk_alloc(family, priority, prot, 1);
874 873
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 49a3900e3d32..4bc27a6334c1 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -133,7 +133,7 @@ int nfattr_parse(struct nfattr *tb[], int maxattr, struct nfattr *nfa, int len)
133 memset(tb, 0, sizeof(struct nfattr *) * maxattr); 133 memset(tb, 0, sizeof(struct nfattr *) * maxattr);
134 134
135 while (NFA_OK(nfa, len)) { 135 while (NFA_OK(nfa, len)) {
136 unsigned flavor = nfa->nfa_type; 136 unsigned flavor = NFA_TYPE(nfa);
137 if (flavor && flavor <= maxattr) 137 if (flavor && flavor <= maxattr)
138 tb[flavor-1] = nfa; 138 tb[flavor-1] = nfa;
139 nfa = NFA_NEXT(nfa, len); 139 nfa = NFA_NEXT(nfa, len);
@@ -177,7 +177,7 @@ nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys,
177 int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len); 177 int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len);
178 178
179 while (NFA_OK(attr, attrlen)) { 179 while (NFA_OK(attr, attrlen)) {
180 unsigned flavor = attr->nfa_type; 180 unsigned flavor = NFA_TYPE(attr);
181 if (flavor) { 181 if (flavor) {
182 if (flavor > attr_count) 182 if (flavor > attr_count)
183 return -EINVAL; 183 return -EINVAL;
@@ -195,7 +195,7 @@ nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys,
195 195
196int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo) 196int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo)
197{ 197{
198 int allocation = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; 198 gfp_t allocation = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
199 int err = 0; 199 int err = 0;
200 200
201 NETLINK_CB(skb).dst_group = group; 201 NETLINK_CB(skb).dst_group = group;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a64e1d5ce3ca..678c3f2c0d0b 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -758,7 +758,7 @@ void netlink_detachskb(struct sock *sk, struct sk_buff *skb)
758} 758}
759 759
760static inline struct sk_buff *netlink_trim(struct sk_buff *skb, 760static inline struct sk_buff *netlink_trim(struct sk_buff *skb,
761 unsigned int __nocast allocation) 761 gfp_t allocation)
762{ 762{
763 int delta; 763 int delta;
764 764
@@ -880,7 +880,7 @@ out:
880} 880}
881 881
882int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid, 882int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid,
883 u32 group, unsigned int __nocast allocation) 883 u32 group, gfp_t allocation)
884{ 884{
885 struct netlink_broadcast_data info; 885 struct netlink_broadcast_data info;
886 struct hlist_node *node; 886 struct hlist_node *node;
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 4e66eef9a034..509afddae569 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -58,7 +58,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
58 58
59 /* Spoof incoming device */ 59 /* Spoof incoming device */
60 skb->dev = dev; 60 skb->dev = dev;
61 skb->h.raw = skb->data; 61 skb->mac.raw = skb->nh.raw;
62 skb->nh.raw = skb->data; 62 skb->nh.raw = skb->data;
63 skb->pkt_type = PACKET_HOST; 63 skb->pkt_type = PACKET_HOST;
64 64
diff --git a/net/rxrpc/call.c b/net/rxrpc/call.c
index 5cfd4cadee42..c4aeb7d40266 100644
--- a/net/rxrpc/call.c
+++ b/net/rxrpc/call.c
@@ -1923,7 +1923,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call,
1923 size_t sioc, 1923 size_t sioc,
1924 struct kvec *siov, 1924 struct kvec *siov,
1925 u8 rxhdr_flags, 1925 u8 rxhdr_flags,
1926 int alloc_flags, 1926 gfp_t alloc_flags,
1927 int dup_data, 1927 int dup_data,
1928 size_t *size_sent) 1928 size_t *size_sent)
1929{ 1929{
diff --git a/net/rxrpc/connection.c b/net/rxrpc/connection.c
index 61463c74f8cc..2ba14a75dbbe 100644
--- a/net/rxrpc/connection.c
+++ b/net/rxrpc/connection.c
@@ -522,7 +522,7 @@ int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
522 uint8_t type, 522 uint8_t type,
523 int dcount, 523 int dcount,
524 struct kvec diov[], 524 struct kvec diov[],
525 int alloc_flags, 525 gfp_t alloc_flags,
526 struct rxrpc_message **_msg) 526 struct rxrpc_message **_msg)
527{ 527{
528 struct rxrpc_message *msg; 528 struct rxrpc_message *msg;
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 45d3bc0812c8..81510da31792 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -72,9 +72,11 @@ config NET_SCH_CLK_GETTIMEOFDAY
72 Choose this if you need a high resolution clock source but can't use 72 Choose this if you need a high resolution clock source but can't use
73 the CPU's cycle counter. 73 the CPU's cycle counter.
74 74
75# don't allow on SMP x86 because they can have unsynchronized TSCs.
76# gettimeofday is a good alternative
75config NET_SCH_CLK_CPU 77config NET_SCH_CLK_CPU
76 bool "CPU cycle counter" 78 bool "CPU cycle counter"
77 depends on X86_TSC || X86_64 || ALPHA || SPARC64 || PPC64 || IA64 79 depends on ((X86_TSC || X86_64) && !SMP) || ALPHA || SPARC64 || PPC64 || IA64
78 help 80 help
79 Say Y here if you want to use the CPU's cycle counter as clock source. 81 Say Y here if you want to use the CPU's cycle counter as clock source.
80 This is a cheap and high resolution clock source, but on some 82 This is a cheap and high resolution clock source, but on some
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 5b24ae0650d3..12b0f582a66b 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -71,7 +71,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
71 const struct sctp_endpoint *ep, 71 const struct sctp_endpoint *ep,
72 const struct sock *sk, 72 const struct sock *sk,
73 sctp_scope_t scope, 73 sctp_scope_t scope,
74 unsigned int __nocast gfp) 74 gfp_t gfp)
75{ 75{
76 struct sctp_sock *sp; 76 struct sctp_sock *sp;
77 int i; 77 int i;
@@ -273,7 +273,7 @@ fail_init:
273struct sctp_association *sctp_association_new(const struct sctp_endpoint *ep, 273struct sctp_association *sctp_association_new(const struct sctp_endpoint *ep,
274 const struct sock *sk, 274 const struct sock *sk,
275 sctp_scope_t scope, 275 sctp_scope_t scope,
276 unsigned int __nocast gfp) 276 gfp_t gfp)
277{ 277{
278 struct sctp_association *asoc; 278 struct sctp_association *asoc;
279 279
@@ -479,7 +479,7 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,
479/* Add a transport address to an association. */ 479/* Add a transport address to an association. */
480struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, 480struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
481 const union sctp_addr *addr, 481 const union sctp_addr *addr,
482 const unsigned int __nocast gfp, 482 const gfp_t gfp,
483 const int peer_state) 483 const int peer_state)
484{ 484{
485 struct sctp_transport *peer; 485 struct sctp_transport *peer;
@@ -1231,7 +1231,7 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned len)
1231 * local endpoint and the remote peer. 1231 * local endpoint and the remote peer.
1232 */ 1232 */
1233int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc, 1233int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
1234 unsigned int __nocast gfp) 1234 gfp_t gfp)
1235{ 1235{
1236 sctp_scope_t scope; 1236 sctp_scope_t scope;
1237 int flags; 1237 int flags;
@@ -1254,7 +1254,7 @@ int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
1254/* Build the association's bind address list from the cookie. */ 1254/* Build the association's bind address list from the cookie. */
1255int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc, 1255int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc,
1256 struct sctp_cookie *cookie, 1256 struct sctp_cookie *cookie,
1257 unsigned int __nocast gfp) 1257 gfp_t gfp)
1258{ 1258{
1259 int var_size2 = ntohs(cookie->peer_init->chunk_hdr.length); 1259 int var_size2 = ntohs(cookie->peer_init->chunk_hdr.length);
1260 int var_size3 = cookie->raw_addr_list_len; 1260 int var_size3 = cookie->raw_addr_list_len;
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index f71549710f2e..2b962627f631 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -53,7 +53,7 @@
53 53
54/* Forward declarations for internal helpers. */ 54/* Forward declarations for internal helpers. */
55static int sctp_copy_one_addr(struct sctp_bind_addr *, union sctp_addr *, 55static int sctp_copy_one_addr(struct sctp_bind_addr *, union sctp_addr *,
56 sctp_scope_t scope, unsigned int __nocast gfp, 56 sctp_scope_t scope, gfp_t gfp,
57 int flags); 57 int flags);
58static void sctp_bind_addr_clean(struct sctp_bind_addr *); 58static void sctp_bind_addr_clean(struct sctp_bind_addr *);
59 59
@@ -64,7 +64,7 @@ static void sctp_bind_addr_clean(struct sctp_bind_addr *);
64 */ 64 */
65int sctp_bind_addr_copy(struct sctp_bind_addr *dest, 65int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
66 const struct sctp_bind_addr *src, 66 const struct sctp_bind_addr *src,
67 sctp_scope_t scope, unsigned int __nocast gfp, 67 sctp_scope_t scope, gfp_t gfp,
68 int flags) 68 int flags)
69{ 69{
70 struct sctp_sockaddr_entry *addr; 70 struct sctp_sockaddr_entry *addr;
@@ -146,7 +146,7 @@ void sctp_bind_addr_free(struct sctp_bind_addr *bp)
146 146
147/* Add an address to the bind address list in the SCTP_bind_addr structure. */ 147/* Add an address to the bind address list in the SCTP_bind_addr structure. */
148int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new, 148int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
149 unsigned int __nocast gfp) 149 gfp_t gfp)
150{ 150{
151 struct sctp_sockaddr_entry *addr; 151 struct sctp_sockaddr_entry *addr;
152 152
@@ -200,7 +200,7 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
200 */ 200 */
201union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, 201union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp,
202 int *addrs_len, 202 int *addrs_len,
203 unsigned int __nocast gfp) 203 gfp_t gfp)
204{ 204{
205 union sctp_params addrparms; 205 union sctp_params addrparms;
206 union sctp_params retval; 206 union sctp_params retval;
@@ -252,7 +252,7 @@ end_raw:
252 * address parameters). 252 * address parameters).
253 */ 253 */
254int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list, 254int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
255 int addrs_len, __u16 port, unsigned int __nocast gfp) 255 int addrs_len, __u16 port, gfp_t gfp)
256{ 256{
257 union sctp_addr_param *rawaddr; 257 union sctp_addr_param *rawaddr;
258 struct sctp_paramhdr *param; 258 struct sctp_paramhdr *param;
@@ -350,7 +350,7 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
350/* Copy out addresses from the global local address list. */ 350/* Copy out addresses from the global local address list. */
351static int sctp_copy_one_addr(struct sctp_bind_addr *dest, 351static int sctp_copy_one_addr(struct sctp_bind_addr *dest,
352 union sctp_addr *addr, 352 union sctp_addr *addr,
353 sctp_scope_t scope, unsigned int __nocast gfp, 353 sctp_scope_t scope, gfp_t gfp,
354 int flags) 354 int flags)
355{ 355{
356 int error = 0; 356 int error = 0;
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c
index 61da2937e641..83ef411772f4 100644
--- a/net/sctp/chunk.c
+++ b/net/sctp/chunk.c
@@ -62,7 +62,7 @@ static void sctp_datamsg_init(struct sctp_datamsg *msg)
62} 62}
63 63
64/* Allocate and initialize datamsg. */ 64/* Allocate and initialize datamsg. */
65SCTP_STATIC struct sctp_datamsg *sctp_datamsg_new(unsigned int __nocast gfp) 65SCTP_STATIC struct sctp_datamsg *sctp_datamsg_new(gfp_t gfp)
66{ 66{
67 struct sctp_datamsg *msg; 67 struct sctp_datamsg *msg;
68 msg = kmalloc(sizeof(struct sctp_datamsg), gfp); 68 msg = kmalloc(sizeof(struct sctp_datamsg), gfp);
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index e22ccd655965..96984f7a2d69 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -68,7 +68,7 @@ static void sctp_endpoint_bh_rcv(struct sctp_endpoint *ep);
68 */ 68 */
69static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, 69static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
70 struct sock *sk, 70 struct sock *sk,
71 unsigned int __nocast gfp) 71 gfp_t gfp)
72{ 72{
73 struct sctp_sock *sp = sctp_sk(sk); 73 struct sctp_sock *sp = sctp_sk(sk);
74 memset(ep, 0, sizeof(struct sctp_endpoint)); 74 memset(ep, 0, sizeof(struct sctp_endpoint));
@@ -138,8 +138,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
138/* Create a sctp_endpoint with all that boring stuff initialized. 138/* Create a sctp_endpoint with all that boring stuff initialized.
139 * Returns NULL if there isn't enough memory. 139 * Returns NULL if there isn't enough memory.
140 */ 140 */
141struct sctp_endpoint *sctp_endpoint_new(struct sock *sk, 141struct sctp_endpoint *sctp_endpoint_new(struct sock *sk, gfp_t gfp)
142 unsigned int __nocast gfp)
143{ 142{
144 struct sctp_endpoint *ep; 143 struct sctp_endpoint *ep;
145 144
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index f01d1c9002a1..26de4d3e1bd9 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -219,7 +219,7 @@ static void sctp_free_local_addr_list(void)
219 219
220/* Copy the local addresses which are valid for 'scope' into 'bp'. */ 220/* Copy the local addresses which are valid for 'scope' into 'bp'. */
221int sctp_copy_local_addr_list(struct sctp_bind_addr *bp, sctp_scope_t scope, 221int sctp_copy_local_addr_list(struct sctp_bind_addr *bp, sctp_scope_t scope,
222 unsigned int __nocast gfp, int copy_flags) 222 gfp_t gfp, int copy_flags)
223{ 223{
224 struct sctp_sockaddr_entry *addr; 224 struct sctp_sockaddr_entry *addr;
225 int error = 0; 225 int error = 0;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 3868a8d70cc0..10e82ec2ebd3 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -78,7 +78,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
78static int sctp_process_param(struct sctp_association *asoc, 78static int sctp_process_param(struct sctp_association *asoc,
79 union sctp_params param, 79 union sctp_params param,
80 const union sctp_addr *peer_addr, 80 const union sctp_addr *peer_addr,
81 unsigned int __nocast gfp); 81 gfp_t gfp);
82 82
83/* What was the inbound interface for this chunk? */ 83/* What was the inbound interface for this chunk? */
84int sctp_chunk_iif(const struct sctp_chunk *chunk) 84int sctp_chunk_iif(const struct sctp_chunk *chunk)
@@ -174,7 +174,7 @@ void sctp_init_cause(struct sctp_chunk *chunk, __u16 cause_code,
174 */ 174 */
175struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, 175struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
176 const struct sctp_bind_addr *bp, 176 const struct sctp_bind_addr *bp,
177 unsigned int __nocast gfp, int vparam_len) 177 gfp_t gfp, int vparam_len)
178{ 178{
179 sctp_inithdr_t init; 179 sctp_inithdr_t init;
180 union sctp_params addrs; 180 union sctp_params addrs;
@@ -261,7 +261,7 @@ nodata:
261 261
262struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, 262struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
263 const struct sctp_chunk *chunk, 263 const struct sctp_chunk *chunk,
264 unsigned int __nocast gfp, int unkparam_len) 264 gfp_t gfp, int unkparam_len)
265{ 265{
266 sctp_inithdr_t initack; 266 sctp_inithdr_t initack;
267 struct sctp_chunk *retval; 267 struct sctp_chunk *retval;
@@ -1234,7 +1234,7 @@ void sctp_chunk_assign_tsn(struct sctp_chunk *chunk)
1234/* Create a CLOSED association to use with an incoming packet. */ 1234/* Create a CLOSED association to use with an incoming packet. */
1235struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep, 1235struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep,
1236 struct sctp_chunk *chunk, 1236 struct sctp_chunk *chunk,
1237 unsigned int __nocast gfp) 1237 gfp_t gfp)
1238{ 1238{
1239 struct sctp_association *asoc; 1239 struct sctp_association *asoc;
1240 struct sk_buff *skb; 1240 struct sk_buff *skb;
@@ -1349,7 +1349,7 @@ nodata:
1349struct sctp_association *sctp_unpack_cookie( 1349struct sctp_association *sctp_unpack_cookie(
1350 const struct sctp_endpoint *ep, 1350 const struct sctp_endpoint *ep,
1351 const struct sctp_association *asoc, 1351 const struct sctp_association *asoc,
1352 struct sctp_chunk *chunk, unsigned int __nocast gfp, 1352 struct sctp_chunk *chunk, gfp_t gfp,
1353 int *error, struct sctp_chunk **errp) 1353 int *error, struct sctp_chunk **errp)
1354{ 1354{
1355 struct sctp_association *retval = NULL; 1355 struct sctp_association *retval = NULL;
@@ -1814,7 +1814,7 @@ int sctp_verify_init(const struct sctp_association *asoc,
1814 */ 1814 */
1815int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, 1815int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid,
1816 const union sctp_addr *peer_addr, 1816 const union sctp_addr *peer_addr,
1817 sctp_init_chunk_t *peer_init, unsigned int __nocast gfp) 1817 sctp_init_chunk_t *peer_init, gfp_t gfp)
1818{ 1818{
1819 union sctp_params param; 1819 union sctp_params param;
1820 struct sctp_transport *transport; 1820 struct sctp_transport *transport;
@@ -1985,7 +1985,7 @@ nomem:
1985static int sctp_process_param(struct sctp_association *asoc, 1985static int sctp_process_param(struct sctp_association *asoc,
1986 union sctp_params param, 1986 union sctp_params param,
1987 const union sctp_addr *peer_addr, 1987 const union sctp_addr *peer_addr,
1988 unsigned int __nocast gfp) 1988 gfp_t gfp)
1989{ 1989{
1990 union sctp_addr addr; 1990 union sctp_addr addr;
1991 int i; 1991 int i;
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 39c970b5b198..f84173ea8ec1 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -63,7 +63,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
63 void *event_arg, 63 void *event_arg,
64 sctp_disposition_t status, 64 sctp_disposition_t status,
65 sctp_cmd_seq_t *commands, 65 sctp_cmd_seq_t *commands,
66 unsigned int __nocast gfp); 66 gfp_t gfp);
67static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, 67static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
68 sctp_state_t state, 68 sctp_state_t state,
69 struct sctp_endpoint *ep, 69 struct sctp_endpoint *ep,
@@ -71,7 +71,7 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
71 void *event_arg, 71 void *event_arg,
72 sctp_disposition_t status, 72 sctp_disposition_t status,
73 sctp_cmd_seq_t *commands, 73 sctp_cmd_seq_t *commands,
74 unsigned int __nocast gfp); 74 gfp_t gfp);
75 75
76/******************************************************************** 76/********************************************************************
77 * Helper functions 77 * Helper functions
@@ -498,7 +498,7 @@ static int sctp_cmd_process_init(sctp_cmd_seq_t *commands,
498 struct sctp_association *asoc, 498 struct sctp_association *asoc,
499 struct sctp_chunk *chunk, 499 struct sctp_chunk *chunk,
500 sctp_init_chunk_t *peer_init, 500 sctp_init_chunk_t *peer_init,
501 unsigned int __nocast gfp) 501 gfp_t gfp)
502{ 502{
503 int error; 503 int error;
504 504
@@ -853,7 +853,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
853 struct sctp_endpoint *ep, 853 struct sctp_endpoint *ep,
854 struct sctp_association *asoc, 854 struct sctp_association *asoc,
855 void *event_arg, 855 void *event_arg,
856 unsigned int __nocast gfp) 856 gfp_t gfp)
857{ 857{
858 sctp_cmd_seq_t commands; 858 sctp_cmd_seq_t commands;
859 const sctp_sm_table_entry_t *state_fn; 859 const sctp_sm_table_entry_t *state_fn;
@@ -898,7 +898,7 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
898 void *event_arg, 898 void *event_arg,
899 sctp_disposition_t status, 899 sctp_disposition_t status,
900 sctp_cmd_seq_t *commands, 900 sctp_cmd_seq_t *commands,
901 unsigned int __nocast gfp) 901 gfp_t gfp)
902{ 902{
903 int error; 903 int error;
904 904
@@ -986,7 +986,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
986 void *event_arg, 986 void *event_arg,
987 sctp_disposition_t status, 987 sctp_disposition_t status,
988 sctp_cmd_seq_t *commands, 988 sctp_cmd_seq_t *commands,
989 unsigned int __nocast gfp) 989 gfp_t gfp)
990{ 990{
991 int error = 0; 991 int error = 0;
992 int force; 992 int force;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 91ec8c936913..02e068d3450d 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3159,8 +3159,9 @@ static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval
3159 return 0; 3159 return 0;
3160} 3160}
3161 3161
3162static int sctp_getsockopt_peer_addrs_num(struct sock *sk, int len, 3162static int sctp_getsockopt_peer_addrs_num_old(struct sock *sk, int len,
3163 char __user *optval, int __user *optlen) 3163 char __user *optval,
3164 int __user *optlen)
3164{ 3165{
3165 sctp_assoc_t id; 3166 sctp_assoc_t id;
3166 struct sctp_association *asoc; 3167 struct sctp_association *asoc;
@@ -3185,23 +3186,28 @@ static int sctp_getsockopt_peer_addrs_num(struct sock *sk, int len,
3185 return cnt; 3186 return cnt;
3186} 3187}
3187 3188
3188static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, 3189/*
3189 char __user *optval, int __user *optlen) 3190 * Old API for getting list of peer addresses. Does not work for 32-bit
3191 * programs running on a 64-bit kernel
3192 */
3193static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len,
3194 char __user *optval,
3195 int __user *optlen)
3190{ 3196{
3191 struct sctp_association *asoc; 3197 struct sctp_association *asoc;
3192 struct list_head *pos; 3198 struct list_head *pos;
3193 int cnt = 0; 3199 int cnt = 0;
3194 struct sctp_getaddrs getaddrs; 3200 struct sctp_getaddrs_old getaddrs;
3195 struct sctp_transport *from; 3201 struct sctp_transport *from;
3196 void __user *to; 3202 void __user *to;
3197 union sctp_addr temp; 3203 union sctp_addr temp;
3198 struct sctp_sock *sp = sctp_sk(sk); 3204 struct sctp_sock *sp = sctp_sk(sk);
3199 int addrlen; 3205 int addrlen;
3200 3206
3201 if (len != sizeof(struct sctp_getaddrs)) 3207 if (len != sizeof(struct sctp_getaddrs_old))
3202 return -EINVAL; 3208 return -EINVAL;
3203 3209
3204 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs))) 3210 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs_old)))
3205 return -EFAULT; 3211 return -EFAULT;
3206 3212
3207 if (getaddrs.addr_num <= 0) return -EINVAL; 3213 if (getaddrs.addr_num <= 0) return -EINVAL;
@@ -3225,15 +3231,69 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
3225 if (cnt >= getaddrs.addr_num) break; 3231 if (cnt >= getaddrs.addr_num) break;
3226 } 3232 }
3227 getaddrs.addr_num = cnt; 3233 getaddrs.addr_num = cnt;
3228 if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs))) 3234 if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs_old)))
3235 return -EFAULT;
3236
3237 return 0;
3238}
3239
3240static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
3241 char __user *optval, int __user *optlen)
3242{
3243 struct sctp_association *asoc;
3244 struct list_head *pos;
3245 int cnt = 0;
3246 struct sctp_getaddrs getaddrs;
3247 struct sctp_transport *from;
3248 void __user *to;
3249 union sctp_addr temp;
3250 struct sctp_sock *sp = sctp_sk(sk);
3251 int addrlen;
3252 size_t space_left;
3253 int bytes_copied;
3254
3255 if (len < sizeof(struct sctp_getaddrs))
3256 return -EINVAL;
3257
3258 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs)))
3259 return -EFAULT;
3260
3261 /* For UDP-style sockets, id specifies the association to query. */
3262 asoc = sctp_id2assoc(sk, getaddrs.assoc_id);
3263 if (!asoc)
3264 return -EINVAL;
3265
3266 to = optval + offsetof(struct sctp_getaddrs,addrs);
3267 space_left = len - sizeof(struct sctp_getaddrs) -
3268 offsetof(struct sctp_getaddrs,addrs);
3269
3270 list_for_each(pos, &asoc->peer.transport_addr_list) {
3271 from = list_entry(pos, struct sctp_transport, transports);
3272 memcpy(&temp, &from->ipaddr, sizeof(temp));
3273 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
3274 addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len;
3275 if(space_left < addrlen)
3276 return -ENOMEM;
3277 temp.v4.sin_port = htons(temp.v4.sin_port);
3278 if (copy_to_user(to, &temp, addrlen))
3279 return -EFAULT;
3280 to += addrlen;
3281 cnt++;
3282 space_left -= addrlen;
3283 }
3284
3285 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num))
3286 return -EFAULT;
3287 bytes_copied = ((char __user *)to) - optval;
3288 if (put_user(bytes_copied, optlen))
3229 return -EFAULT; 3289 return -EFAULT;
3230 3290
3231 return 0; 3291 return 0;
3232} 3292}
3233 3293
3234static int sctp_getsockopt_local_addrs_num(struct sock *sk, int len, 3294static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len,
3235 char __user *optval, 3295 char __user *optval,
3236 int __user *optlen) 3296 int __user *optlen)
3237{ 3297{
3238 sctp_assoc_t id; 3298 sctp_assoc_t id;
3239 struct sctp_bind_addr *bp; 3299 struct sctp_bind_addr *bp;
@@ -3306,8 +3366,8 @@ done:
3306/* Helper function that copies local addresses to user and returns the number 3366/* Helper function that copies local addresses to user and returns the number
3307 * of addresses copied. 3367 * of addresses copied.
3308 */ 3368 */
3309static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port, int max_addrs, 3369static int sctp_copy_laddrs_to_user_old(struct sock *sk, __u16 port, int max_addrs,
3310 void __user *to) 3370 void __user *to)
3311{ 3371{
3312 struct list_head *pos; 3372 struct list_head *pos;
3313 struct sctp_sockaddr_entry *addr; 3373 struct sctp_sockaddr_entry *addr;
@@ -3341,14 +3401,54 @@ static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port, int max_addrs,
3341 return cnt; 3401 return cnt;
3342} 3402}
3343 3403
3344static int sctp_getsockopt_local_addrs(struct sock *sk, int len, 3404static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port,
3345 char __user *optval, int __user *optlen) 3405 void * __user *to, size_t space_left)
3406{
3407 struct list_head *pos;
3408 struct sctp_sockaddr_entry *addr;
3409 unsigned long flags;
3410 union sctp_addr temp;
3411 int cnt = 0;
3412 int addrlen;
3413
3414 sctp_spin_lock_irqsave(&sctp_local_addr_lock, flags);
3415 list_for_each(pos, &sctp_local_addr_list) {
3416 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
3417 if ((PF_INET == sk->sk_family) &&
3418 (AF_INET6 == addr->a.sa.sa_family))
3419 continue;
3420 memcpy(&temp, &addr->a, sizeof(temp));
3421 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk),
3422 &temp);
3423 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
3424 if(space_left<addrlen)
3425 return -ENOMEM;
3426 temp.v4.sin_port = htons(port);
3427 if (copy_to_user(*to, &temp, addrlen)) {
3428 sctp_spin_unlock_irqrestore(&sctp_local_addr_lock,
3429 flags);
3430 return -EFAULT;
3431 }
3432 *to += addrlen;
3433 cnt ++;
3434 space_left -= addrlen;
3435 }
3436 sctp_spin_unlock_irqrestore(&sctp_local_addr_lock, flags);
3437
3438 return cnt;
3439}
3440
3441/* Old API for getting list of local addresses. Does not work for 32-bit
3442 * programs running on a 64-bit kernel
3443 */
3444static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len,
3445 char __user *optval, int __user *optlen)
3346{ 3446{
3347 struct sctp_bind_addr *bp; 3447 struct sctp_bind_addr *bp;
3348 struct sctp_association *asoc; 3448 struct sctp_association *asoc;
3349 struct list_head *pos; 3449 struct list_head *pos;
3350 int cnt = 0; 3450 int cnt = 0;
3351 struct sctp_getaddrs getaddrs; 3451 struct sctp_getaddrs_old getaddrs;
3352 struct sctp_sockaddr_entry *addr; 3452 struct sctp_sockaddr_entry *addr;
3353 void __user *to; 3453 void __user *to;
3354 union sctp_addr temp; 3454 union sctp_addr temp;
@@ -3357,10 +3457,10 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
3357 rwlock_t *addr_lock; 3457 rwlock_t *addr_lock;
3358 int err = 0; 3458 int err = 0;
3359 3459
3360 if (len != sizeof(struct sctp_getaddrs)) 3460 if (len != sizeof(struct sctp_getaddrs_old))
3361 return -EINVAL; 3461 return -EINVAL;
3362 3462
3363 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs))) 3463 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs_old)))
3364 return -EFAULT; 3464 return -EFAULT;
3365 3465
3366 if (getaddrs.addr_num <= 0) return -EINVAL; 3466 if (getaddrs.addr_num <= 0) return -EINVAL;
@@ -3392,8 +3492,9 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
3392 addr = list_entry(bp->address_list.next, 3492 addr = list_entry(bp->address_list.next,
3393 struct sctp_sockaddr_entry, list); 3493 struct sctp_sockaddr_entry, list);
3394 if (sctp_is_any(&addr->a)) { 3494 if (sctp_is_any(&addr->a)) {
3395 cnt = sctp_copy_laddrs_to_user(sk, bp->port, 3495 cnt = sctp_copy_laddrs_to_user_old(sk, bp->port,
3396 getaddrs.addr_num, to); 3496 getaddrs.addr_num,
3497 to);
3397 if (cnt < 0) { 3498 if (cnt < 0) {
3398 err = cnt; 3499 err = cnt;
3399 goto unlock; 3500 goto unlock;
@@ -3419,7 +3520,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
3419 3520
3420copy_getaddrs: 3521copy_getaddrs:
3421 getaddrs.addr_num = cnt; 3522 getaddrs.addr_num = cnt;
3422 if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs))) 3523 if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs_old)))
3423 err = -EFAULT; 3524 err = -EFAULT;
3424 3525
3425unlock: 3526unlock:
@@ -3427,6 +3528,99 @@ unlock:
3427 return err; 3528 return err;
3428} 3529}
3429 3530
3531static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
3532 char __user *optval, int __user *optlen)
3533{
3534 struct sctp_bind_addr *bp;
3535 struct sctp_association *asoc;
3536 struct list_head *pos;
3537 int cnt = 0;
3538 struct sctp_getaddrs getaddrs;
3539 struct sctp_sockaddr_entry *addr;
3540 void __user *to;
3541 union sctp_addr temp;
3542 struct sctp_sock *sp = sctp_sk(sk);
3543 int addrlen;
3544 rwlock_t *addr_lock;
3545 int err = 0;
3546 size_t space_left;
3547 int bytes_copied;
3548
3549 if (len <= sizeof(struct sctp_getaddrs))
3550 return -EINVAL;
3551
3552 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs)))
3553 return -EFAULT;
3554
3555 /*
3556 * For UDP-style sockets, id specifies the association to query.
3557 * If the id field is set to the value '0' then the locally bound
3558 * addresses are returned without regard to any particular
3559 * association.
3560 */
3561 if (0 == getaddrs.assoc_id) {
3562 bp = &sctp_sk(sk)->ep->base.bind_addr;
3563 addr_lock = &sctp_sk(sk)->ep->base.addr_lock;
3564 } else {
3565 asoc = sctp_id2assoc(sk, getaddrs.assoc_id);
3566 if (!asoc)
3567 return -EINVAL;
3568 bp = &asoc->base.bind_addr;
3569 addr_lock = &asoc->base.addr_lock;
3570 }
3571
3572 to = optval + offsetof(struct sctp_getaddrs,addrs);
3573 space_left = len - sizeof(struct sctp_getaddrs) -
3574 offsetof(struct sctp_getaddrs,addrs);
3575
3576 sctp_read_lock(addr_lock);
3577
3578 /* If the endpoint is bound to 0.0.0.0 or ::0, get the valid
3579 * addresses from the global local address list.
3580 */
3581 if (sctp_list_single_entry(&bp->address_list)) {
3582 addr = list_entry(bp->address_list.next,
3583 struct sctp_sockaddr_entry, list);
3584 if (sctp_is_any(&addr->a)) {
3585 cnt = sctp_copy_laddrs_to_user(sk, bp->port,
3586 &to, space_left);
3587 if (cnt < 0) {
3588 err = cnt;
3589 goto unlock;
3590 }
3591 goto copy_getaddrs;
3592 }
3593 }
3594
3595 list_for_each(pos, &bp->address_list) {
3596 addr = list_entry(pos, struct sctp_sockaddr_entry, list);
3597 memcpy(&temp, &addr->a, sizeof(temp));
3598 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
3599 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
3600 if(space_left < addrlen)
3601 return -ENOMEM; /*fixme: right error?*/
3602 temp.v4.sin_port = htons(temp.v4.sin_port);
3603 if (copy_to_user(to, &temp, addrlen)) {
3604 err = -EFAULT;
3605 goto unlock;
3606 }
3607 to += addrlen;
3608 cnt ++;
3609 space_left -= addrlen;
3610 }
3611
3612copy_getaddrs:
3613 if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num))
3614 return -EFAULT;
3615 bytes_copied = ((char __user *)to) - optval;
3616 if (put_user(bytes_copied, optlen))
3617 return -EFAULT;
3618
3619unlock:
3620 sctp_read_unlock(addr_lock);
3621 return err;
3622}
3623
3430/* 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) 3624/* 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
3431 * 3625 *
3432 * Requests that the local SCTP stack use the enclosed peer address as 3626 * Requests that the local SCTP stack use the enclosed peer address as
@@ -3807,12 +4001,20 @@ SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname,
3807 case SCTP_INITMSG: 4001 case SCTP_INITMSG:
3808 retval = sctp_getsockopt_initmsg(sk, len, optval, optlen); 4002 retval = sctp_getsockopt_initmsg(sk, len, optval, optlen);
3809 break; 4003 break;
3810 case SCTP_GET_PEER_ADDRS_NUM: 4004 case SCTP_GET_PEER_ADDRS_NUM_OLD:
3811 retval = sctp_getsockopt_peer_addrs_num(sk, len, optval, 4005 retval = sctp_getsockopt_peer_addrs_num_old(sk, len, optval,
4006 optlen);
4007 break;
4008 case SCTP_GET_LOCAL_ADDRS_NUM_OLD:
4009 retval = sctp_getsockopt_local_addrs_num_old(sk, len, optval,
4010 optlen);
4011 break;
4012 case SCTP_GET_PEER_ADDRS_OLD:
4013 retval = sctp_getsockopt_peer_addrs_old(sk, len, optval,
3812 optlen); 4014 optlen);
3813 break; 4015 break;
3814 case SCTP_GET_LOCAL_ADDRS_NUM: 4016 case SCTP_GET_LOCAL_ADDRS_OLD:
3815 retval = sctp_getsockopt_local_addrs_num(sk, len, optval, 4017 retval = sctp_getsockopt_local_addrs_old(sk, len, optval,
3816 optlen); 4018 optlen);
3817 break; 4019 break;
3818 case SCTP_GET_PEER_ADDRS: 4020 case SCTP_GET_PEER_ADDRS:
diff --git a/net/sctp/ssnmap.c b/net/sctp/ssnmap.c
index 25037daf3fa0..cbe2513d2822 100644
--- a/net/sctp/ssnmap.c
+++ b/net/sctp/ssnmap.c
@@ -58,7 +58,7 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
58 * Allocate room to store at least 'len' contiguous TSNs. 58 * Allocate room to store at least 'len' contiguous TSNs.
59 */ 59 */
60struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, 60struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
61 unsigned int __nocast gfp) 61 gfp_t gfp)
62{ 62{
63 struct sctp_ssnmap *retval; 63 struct sctp_ssnmap *retval;
64 int size; 64 int size;
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index d2f04ebe5081..6bc27200e6ca 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -57,7 +57,7 @@
57/* Initialize a new transport from provided memory. */ 57/* Initialize a new transport from provided memory. */
58static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer, 58static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
59 const union sctp_addr *addr, 59 const union sctp_addr *addr,
60 unsigned int __nocast gfp) 60 gfp_t gfp)
61{ 61{
62 /* Copy in the address. */ 62 /* Copy in the address. */
63 peer->ipaddr = *addr; 63 peer->ipaddr = *addr;
@@ -122,7 +122,7 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
122 122
123/* Allocate and initialize a new transport. */ 123/* Allocate and initialize a new transport. */
124struct sctp_transport *sctp_transport_new(const union sctp_addr *addr, 124struct sctp_transport *sctp_transport_new(const union sctp_addr *addr,
125 unsigned int __nocast gfp) 125 gfp_t gfp)
126{ 126{
127 struct sctp_transport *transport; 127 struct sctp_transport *transport;
128 128
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index 0abd5101107c..057e7fac3af0 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -74,7 +74,7 @@ SCTP_STATIC void sctp_ulpevent_init(struct sctp_ulpevent *event, int msg_flags)
74 74
75/* Create a new sctp_ulpevent. */ 75/* Create a new sctp_ulpevent. */
76SCTP_STATIC struct sctp_ulpevent *sctp_ulpevent_new(int size, int msg_flags, 76SCTP_STATIC struct sctp_ulpevent *sctp_ulpevent_new(int size, int msg_flags,
77 unsigned int __nocast gfp) 77 gfp_t gfp)
78{ 78{
79 struct sctp_ulpevent *event; 79 struct sctp_ulpevent *event;
80 struct sk_buff *skb; 80 struct sk_buff *skb;
@@ -136,7 +136,7 @@ static inline void sctp_ulpevent_release_owner(struct sctp_ulpevent *event)
136struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( 136struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
137 const struct sctp_association *asoc, 137 const struct sctp_association *asoc,
138 __u16 flags, __u16 state, __u16 error, __u16 outbound, 138 __u16 flags, __u16 state, __u16 error, __u16 outbound,
139 __u16 inbound, unsigned int __nocast gfp) 139 __u16 inbound, gfp_t gfp)
140{ 140{
141 struct sctp_ulpevent *event; 141 struct sctp_ulpevent *event;
142 struct sctp_assoc_change *sac; 142 struct sctp_assoc_change *sac;
@@ -237,7 +237,7 @@ fail:
237struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( 237struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
238 const struct sctp_association *asoc, 238 const struct sctp_association *asoc,
239 const struct sockaddr_storage *aaddr, 239 const struct sockaddr_storage *aaddr,
240 int flags, int state, int error, unsigned int __nocast gfp) 240 int flags, int state, int error, gfp_t gfp)
241{ 241{
242 struct sctp_ulpevent *event; 242 struct sctp_ulpevent *event;
243 struct sctp_paddr_change *spc; 243 struct sctp_paddr_change *spc;
@@ -350,7 +350,7 @@ fail:
350 */ 350 */
351struct sctp_ulpevent *sctp_ulpevent_make_remote_error( 351struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
352 const struct sctp_association *asoc, struct sctp_chunk *chunk, 352 const struct sctp_association *asoc, struct sctp_chunk *chunk,
353 __u16 flags, unsigned int __nocast gfp) 353 __u16 flags, gfp_t gfp)
354{ 354{
355 struct sctp_ulpevent *event; 355 struct sctp_ulpevent *event;
356 struct sctp_remote_error *sre; 356 struct sctp_remote_error *sre;
@@ -448,7 +448,7 @@ fail:
448 */ 448 */
449struct sctp_ulpevent *sctp_ulpevent_make_send_failed( 449struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
450 const struct sctp_association *asoc, struct sctp_chunk *chunk, 450 const struct sctp_association *asoc, struct sctp_chunk *chunk,
451 __u16 flags, __u32 error, unsigned int __nocast gfp) 451 __u16 flags, __u32 error, gfp_t gfp)
452{ 452{
453 struct sctp_ulpevent *event; 453 struct sctp_ulpevent *event;
454 struct sctp_send_failed *ssf; 454 struct sctp_send_failed *ssf;
@@ -557,7 +557,7 @@ fail:
557 */ 557 */
558struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event( 558struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
559 const struct sctp_association *asoc, 559 const struct sctp_association *asoc,
560 __u16 flags, unsigned int __nocast gfp) 560 __u16 flags, gfp_t gfp)
561{ 561{
562 struct sctp_ulpevent *event; 562 struct sctp_ulpevent *event;
563 struct sctp_shutdown_event *sse; 563 struct sctp_shutdown_event *sse;
@@ -620,7 +620,7 @@ fail:
620 * 5.3.1.6 SCTP_ADAPTION_INDICATION 620 * 5.3.1.6 SCTP_ADAPTION_INDICATION
621 */ 621 */
622struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication( 622struct sctp_ulpevent *sctp_ulpevent_make_adaption_indication(
623 const struct sctp_association *asoc, unsigned int __nocast gfp) 623 const struct sctp_association *asoc, gfp_t gfp)
624{ 624{
625 struct sctp_ulpevent *event; 625 struct sctp_ulpevent *event;
626 struct sctp_adaption_event *sai; 626 struct sctp_adaption_event *sai;
@@ -657,7 +657,7 @@ fail:
657 */ 657 */
658struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, 658struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
659 struct sctp_chunk *chunk, 659 struct sctp_chunk *chunk,
660 unsigned int __nocast gfp) 660 gfp_t gfp)
661{ 661{
662 struct sctp_ulpevent *event = NULL; 662 struct sctp_ulpevent *event = NULL;
663 struct sk_buff *skb; 663 struct sk_buff *skb;
@@ -719,7 +719,7 @@ fail:
719 */ 719 */
720struct sctp_ulpevent *sctp_ulpevent_make_pdapi( 720struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
721 const struct sctp_association *asoc, __u32 indication, 721 const struct sctp_association *asoc, __u32 indication,
722 unsigned int __nocast gfp) 722 gfp_t gfp)
723{ 723{
724 struct sctp_ulpevent *event; 724 struct sctp_ulpevent *event;
725 struct sctp_pdapi_event *pd; 725 struct sctp_pdapi_event *pd;
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index ec2c857eae7f..2080b2d28c98 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -100,7 +100,7 @@ void sctp_ulpq_free(struct sctp_ulpq *ulpq)
100 100
101/* Process an incoming DATA chunk. */ 101/* Process an incoming DATA chunk. */
102int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, 102int sctp_ulpq_tail_data(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
103 unsigned int __nocast gfp) 103 gfp_t gfp)
104{ 104{
105 struct sk_buff_head temp; 105 struct sk_buff_head temp;
106 sctp_data_chunk_t *hdr; 106 sctp_data_chunk_t *hdr;
@@ -792,7 +792,7 @@ static __u16 sctp_ulpq_renege_frags(struct sctp_ulpq *ulpq, __u16 needed)
792/* Partial deliver the first message as there is pressure on rwnd. */ 792/* Partial deliver the first message as there is pressure on rwnd. */
793void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq, 793void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq,
794 struct sctp_chunk *chunk, 794 struct sctp_chunk *chunk,
795 unsigned int __nocast gfp) 795 gfp_t gfp)
796{ 796{
797 struct sctp_ulpevent *event; 797 struct sctp_ulpevent *event;
798 struct sctp_association *asoc; 798 struct sctp_association *asoc;
@@ -816,7 +816,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *ulpq,
816 816
817/* Renege some packets to make room for an incoming chunk. */ 817/* Renege some packets to make room for an incoming chunk. */
818void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk, 818void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
819 unsigned int __nocast gfp) 819 gfp_t gfp)
820{ 820{
821 struct sctp_association *asoc; 821 struct sctp_association *asoc;
822 __u16 needed, freed; 822 __u16 needed, freed;
@@ -855,7 +855,7 @@ void sctp_ulpq_renege(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk,
855/* Notify the application if an association is aborted and in 855/* Notify the application if an association is aborted and in
856 * partial delivery mode. Send up any pending received messages. 856 * partial delivery mode. Send up any pending received messages.
857 */ 857 */
858void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, unsigned int __nocast gfp) 858void sctp_ulpq_abort_pd(struct sctp_ulpq *ulpq, gfp_t gfp)
859{ 859{
860 struct sctp_ulpevent *ev = NULL; 860 struct sctp_ulpevent *ev = NULL;
861 struct sock *sk; 861 struct sock *sk;
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index f3104035e35d..54e60a657500 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -719,7 +719,7 @@ static void rpc_async_schedule(void *arg)
719void * 719void *
720rpc_malloc(struct rpc_task *task, size_t size) 720rpc_malloc(struct rpc_task *task, size_t size)
721{ 721{
722 int gfp; 722 gfp_t gfp;
723 723
724 if (task->tk_flags & RPC_TASK_SWAPPER) 724 if (task->tk_flags & RPC_TASK_SWAPPER)
725 gfp = GFP_ATOMIC; 725 gfp = GFP_ATOMIC;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index fda737d77edc..cbb0ba34a600 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -163,7 +163,7 @@ static void xfrm_policy_timer(unsigned long data)
163 if (xp->dead) 163 if (xp->dead)
164 goto out; 164 goto out;
165 165
166 dir = xp->index & 7; 166 dir = xfrm_policy_id2dir(xp->index);
167 167
168 if (xp->lft.hard_add_expires_seconds) { 168 if (xp->lft.hard_add_expires_seconds) {
169 long tmo = xp->lft.hard_add_expires_seconds + 169 long tmo = xp->lft.hard_add_expires_seconds +
@@ -225,7 +225,7 @@ expired:
225 * SPD calls. 225 * SPD calls.
226 */ 226 */
227 227
228struct xfrm_policy *xfrm_policy_alloc(int gfp) 228struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp)
229{ 229{
230 struct xfrm_policy *policy; 230 struct xfrm_policy *policy;
231 231
@@ -417,7 +417,7 @@ struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete)
417 struct xfrm_policy *pol, **p; 417 struct xfrm_policy *pol, **p;
418 418
419 write_lock_bh(&xfrm_policy_lock); 419 write_lock_bh(&xfrm_policy_lock);
420 for (p = &xfrm_policy_list[id & 7]; (pol=*p)!=NULL; p = &pol->next) { 420 for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL; p = &pol->next) {
421 if (pol->index == id) { 421 if (pol->index == id) {
422 xfrm_pol_hold(pol); 422 xfrm_pol_hold(pol);
423 if (delete) 423 if (delete)