aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_sock.c6
-rw-r--r--net/core/dev.c79
-rw-r--r--net/core/net-sysfs.c8
-rw-r--r--net/core/skbuff.c5
-rw-r--r--net/ipv4/Kconfig7
-rw-r--r--net/ipv4/icmp.c5
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c2
-rw-r--r--net/ipv4/proc.c21
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/tcp_cong.c40
-rw-r--r--net/ipv4/tcp_input.c3
-rw-r--r--net/ipv6/ip6_input.c2
-rw-r--r--net/ipx/af_ipx.c2
-rw-r--r--net/key/af_key.c2
-rw-r--r--net/netfilter/nf_conntrack_core.c8
-rw-r--r--net/rfkill/rfkill.c2
-rw-r--r--net/sched/sch_prio.c2
-rw-r--r--net/socket.c3
-rw-r--r--net/sunrpc/rpc_pipe.c24
-rw-r--r--net/sunrpc/sched.c2
-rw-r--r--net/sunrpc/sunrpc_syms.c4
-rw-r--r--net/xfrm/xfrm_algo.c140
-rw-r--r--net/xfrm/xfrm_hash.c3
-rw-r--r--net/xfrm/xfrm_policy.c4
24 files changed, 245 insertions, 133 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index bfc9a35bad33..1dae3dfc66a9 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -665,7 +665,8 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
665 /* Detach sockets from device */ 665 /* Detach sockets from device */
666 read_lock(&hci_sk_list.lock); 666 read_lock(&hci_sk_list.lock);
667 sk_for_each(sk, node, &hci_sk_list.head) { 667 sk_for_each(sk, node, &hci_sk_list.head) {
668 lock_sock(sk); 668 local_bh_disable();
669 bh_lock_sock_nested(sk);
669 if (hci_pi(sk)->hdev == hdev) { 670 if (hci_pi(sk)->hdev == hdev) {
670 hci_pi(sk)->hdev = NULL; 671 hci_pi(sk)->hdev = NULL;
671 sk->sk_err = EPIPE; 672 sk->sk_err = EPIPE;
@@ -674,7 +675,8 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
674 675
675 hci_dev_put(hdev); 676 hci_dev_put(hdev);
676 } 677 }
677 release_sock(sk); 678 bh_unlock_sock(sk);
679 local_bh_enable();
678 } 680 }
679 read_unlock(&hci_sk_list.lock); 681 read_unlock(&hci_sk_list.lock);
680 } 682 }
diff --git a/net/core/dev.c b/net/core/dev.c
index 8301e2ac747f..5a7f20f78574 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -116,6 +116,7 @@
116#include <linux/dmaengine.h> 116#include <linux/dmaengine.h>
117#include <linux/err.h> 117#include <linux/err.h>
118#include <linux/ctype.h> 118#include <linux/ctype.h>
119#include <linux/if_arp.h>
119 120
120/* 121/*
121 * The list of packet types we will receive (as opposed to discard) 122 * The list of packet types we will receive (as opposed to discard)
@@ -217,6 +218,73 @@ extern void netdev_unregister_sysfs(struct net_device *);
217#define netdev_unregister_sysfs(dev) do { } while(0) 218#define netdev_unregister_sysfs(dev) do { } while(0)
218#endif 219#endif
219 220
221#ifdef CONFIG_DEBUG_LOCK_ALLOC
222/*
223 * register_netdevice() inits dev->_xmit_lock and sets lockdep class
224 * according to dev->type
225 */
226static const unsigned short netdev_lock_type[] =
227 {ARPHRD_NETROM, ARPHRD_ETHER, ARPHRD_EETHER, ARPHRD_AX25,
228 ARPHRD_PRONET, ARPHRD_CHAOS, ARPHRD_IEEE802, ARPHRD_ARCNET,
229 ARPHRD_APPLETLK, ARPHRD_DLCI, ARPHRD_ATM, ARPHRD_METRICOM,
230 ARPHRD_IEEE1394, ARPHRD_EUI64, ARPHRD_INFINIBAND, ARPHRD_SLIP,
231 ARPHRD_CSLIP, ARPHRD_SLIP6, ARPHRD_CSLIP6, ARPHRD_RSRVD,
232 ARPHRD_ADAPT, ARPHRD_ROSE, ARPHRD_X25, ARPHRD_HWX25,
233 ARPHRD_PPP, ARPHRD_CISCO, ARPHRD_LAPB, ARPHRD_DDCMP,
234 ARPHRD_RAWHDLC, ARPHRD_TUNNEL, ARPHRD_TUNNEL6, ARPHRD_FRAD,
235 ARPHRD_SKIP, ARPHRD_LOOPBACK, ARPHRD_LOCALTLK, ARPHRD_FDDI,
236 ARPHRD_BIF, ARPHRD_SIT, ARPHRD_IPDDP, ARPHRD_IPGRE,
237 ARPHRD_PIMREG, ARPHRD_HIPPI, ARPHRD_ASH, ARPHRD_ECONET,
238 ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL,
239 ARPHRD_FCFABRIC, ARPHRD_IEEE802_TR, ARPHRD_IEEE80211,
240 ARPHRD_IEEE80211_PRISM, ARPHRD_IEEE80211_RADIOTAP, ARPHRD_VOID,
241 ARPHRD_NONE};
242
243static const char *netdev_lock_name[] =
244 {"_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25",
245 "_xmit_PRONET", "_xmit_CHAOS", "_xmit_IEEE802", "_xmit_ARCNET",
246 "_xmit_APPLETLK", "_xmit_DLCI", "_xmit_ATM", "_xmit_METRICOM",
247 "_xmit_IEEE1394", "_xmit_EUI64", "_xmit_INFINIBAND", "_xmit_SLIP",
248 "_xmit_CSLIP", "_xmit_SLIP6", "_xmit_CSLIP6", "_xmit_RSRVD",
249 "_xmit_ADAPT", "_xmit_ROSE", "_xmit_X25", "_xmit_HWX25",
250 "_xmit_PPP", "_xmit_CISCO", "_xmit_LAPB", "_xmit_DDCMP",
251 "_xmit_RAWHDLC", "_xmit_TUNNEL", "_xmit_TUNNEL6", "_xmit_FRAD",
252 "_xmit_SKIP", "_xmit_LOOPBACK", "_xmit_LOCALTLK", "_xmit_FDDI",
253 "_xmit_BIF", "_xmit_SIT", "_xmit_IPDDP", "_xmit_IPGRE",
254 "_xmit_PIMREG", "_xmit_HIPPI", "_xmit_ASH", "_xmit_ECONET",
255 "_xmit_IRDA", "_xmit_FCPP", "_xmit_FCAL", "_xmit_FCPL",
256 "_xmit_FCFABRIC", "_xmit_IEEE802_TR", "_xmit_IEEE80211",
257 "_xmit_IEEE80211_PRISM", "_xmit_IEEE80211_RADIOTAP", "_xmit_VOID",
258 "_xmit_NONE"};
259
260static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)];
261
262static inline unsigned short netdev_lock_pos(unsigned short dev_type)
263{
264 int i;
265
266 for (i = 0; i < ARRAY_SIZE(netdev_lock_type); i++)
267 if (netdev_lock_type[i] == dev_type)
268 return i;
269 /* the last key is used by default */
270 return ARRAY_SIZE(netdev_lock_type) - 1;
271}
272
273static inline void netdev_set_lockdep_class(spinlock_t *lock,
274 unsigned short dev_type)
275{
276 int i;
277
278 i = netdev_lock_pos(dev_type);
279 lockdep_set_class_and_name(lock, &netdev_xmit_lock_key[i],
280 netdev_lock_name[i]);
281}
282#else
283static inline void netdev_set_lockdep_class(spinlock_t *lock,
284 unsigned short dev_type)
285{
286}
287#endif
220 288
221/******************************************************************************* 289/*******************************************************************************
222 290
@@ -3001,6 +3069,7 @@ int register_netdevice(struct net_device *dev)
3001 3069
3002 spin_lock_init(&dev->queue_lock); 3070 spin_lock_init(&dev->queue_lock);
3003 spin_lock_init(&dev->_xmit_lock); 3071 spin_lock_init(&dev->_xmit_lock);
3072 netdev_set_lockdep_class(&dev->_xmit_lock, dev->type);
3004 dev->xmit_lock_owner = -1; 3073 dev->xmit_lock_owner = -1;
3005 spin_lock_init(&dev->ingress_lock); 3074 spin_lock_init(&dev->ingress_lock);
3006 3075
@@ -3245,7 +3314,6 @@ void netdev_run_todo(void)
3245 continue; 3314 continue;
3246 } 3315 }
3247 3316
3248 netdev_unregister_sysfs(dev);
3249 dev->reg_state = NETREG_UNREGISTERED; 3317 dev->reg_state = NETREG_UNREGISTERED;
3250 3318
3251 netdev_wait_allrefs(dev); 3319 netdev_wait_allrefs(dev);
@@ -3256,11 +3324,11 @@ void netdev_run_todo(void)
3256 BUG_TRAP(!dev->ip6_ptr); 3324 BUG_TRAP(!dev->ip6_ptr);
3257 BUG_TRAP(!dev->dn_ptr); 3325 BUG_TRAP(!dev->dn_ptr);
3258 3326
3259 /* It must be the very last action,
3260 * after this 'dev' may point to freed up memory.
3261 */
3262 if (dev->destructor) 3327 if (dev->destructor)
3263 dev->destructor(dev); 3328 dev->destructor(dev);
3329
3330 /* Free network device */
3331 kobject_put(&dev->dev.kobj);
3264 } 3332 }
3265 3333
3266out: 3334out:
@@ -3411,6 +3479,9 @@ void unregister_netdevice(struct net_device *dev)
3411 /* Notifier chain MUST detach us from master device. */ 3479 /* Notifier chain MUST detach us from master device. */
3412 BUG_TRAP(!dev->master); 3480 BUG_TRAP(!dev->master);
3413 3481
3482 /* Remove entries from sysfs */
3483 netdev_unregister_sysfs(dev);
3484
3414 /* Finish processing unregister after unlock */ 3485 /* Finish processing unregister after unlock */
3415 net_set_todo(dev); 3486 net_set_todo(dev);
3416 3487
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index b21307b15b82..5c19b0646d7a 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -456,9 +456,15 @@ static struct class net_class = {
456#endif 456#endif
457}; 457};
458 458
459/* Delete sysfs entries but hold kobject reference until after all
460 * netdev references are gone.
461 */
459void netdev_unregister_sysfs(struct net_device * net) 462void netdev_unregister_sysfs(struct net_device * net)
460{ 463{
461 device_del(&(net->dev)); 464 struct device *dev = &(net->dev);
465
466 kobject_get(&dev->kobj);
467 device_del(dev);
462} 468}
463 469
464/* Create sysfs entries for network device. */ 470/* Create sysfs entries for network device. */
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 142257307fa2..7c6a34e21eee 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -644,11 +644,10 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
644 644
645 /* Copy only real data... and, alas, header. This should be 645 /* Copy only real data... and, alas, header. This should be
646 * optimized for the cases when header is void. */ 646 * optimized for the cases when header is void. */
647 memcpy(data + nhead, skb->head,
648#ifdef NET_SKBUFF_DATA_USES_OFFSET 647#ifdef NET_SKBUFF_DATA_USES_OFFSET
649 skb->tail); 648 memcpy(data + nhead, skb->head, skb->tail);
650#else 649#else
651 skb->tail - skb->head); 650 memcpy(data + nhead, skb->head, skb->tail - skb->head);
652#endif 651#endif
653 memcpy(data + size, skb_end_pointer(skb), 652 memcpy(data + size, skb_end_pointer(skb),
654 sizeof(struct skb_shared_info)); 653 sizeof(struct skb_shared_info));
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index c68196cc56ab..010fbb2d45e9 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -43,11 +43,11 @@ config IP_ADVANCED_ROUTER
43 asymmetric routing (packets from you to a host take a different path 43 asymmetric routing (packets from you to a host take a different path
44 than packets from that host to you) or if you operate a non-routing 44 than packets from that host to you) or if you operate a non-routing
45 host which has several IP addresses on different interfaces. To turn 45 host which has several IP addresses on different interfaces. To turn
46 rp_filter off use: 46 rp_filter on use:
47 47
48 echo 0 > /proc/sys/net/ipv4/conf/<device>/rp_filter 48 echo 1 > /proc/sys/net/ipv4/conf/<device>/rp_filter
49 or 49 or
50 echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter 50 echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
51 51
52 If unsure, say N here. 52 If unsure, say N here.
53 53
@@ -577,6 +577,7 @@ config TCP_CONG_VENO
577config TCP_CONG_YEAH 577config TCP_CONG_YEAH
578 tristate "YeAH TCP" 578 tristate "YeAH TCP"
579 depends on EXPERIMENTAL 579 depends on EXPERIMENTAL
580 select TCP_CONG_VEGAS
580 default n 581 default n
581 ---help--- 582 ---help---
582 YeAH-TCP is a sender-side high-speed enabled TCP congestion control 583 YeAH-TCP is a sender-side high-speed enabled TCP congestion control
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index d38cbba92a4d..e238b17f554c 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -514,7 +514,10 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
514 514
515 saddr = iph->daddr; 515 saddr = iph->daddr;
516 if (!(rt->rt_flags & RTCF_LOCAL)) { 516 if (!(rt->rt_flags & RTCF_LOCAL)) {
517 if (sysctl_icmp_errors_use_inbound_ifaddr) 517 /* This is broken, skb_in->dev points to the outgoing device
518 * after the packet passes through ip_output().
519 */
520 if (skb_in->dev && sysctl_icmp_errors_use_inbound_ifaddr)
518 saddr = inet_select_addr(skb_in->dev, 0, RT_SCOPE_LINK); 521 saddr = inet_select_addr(skb_in->dev, 0, RT_SCOPE_LINK);
519 else 522 else
520 saddr = 0; 523 saddr = 0;
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index 0654eaae70c9..fd62a41d69cc 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -154,12 +154,10 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
154 const struct net_device *out, 154 const struct net_device *out,
155 int (*okfn)(struct sk_buff *)) 155 int (*okfn)(struct sk_buff *))
156{ 156{
157#if !defined(CONFIG_IP_NF_NAT) && !defined(CONFIG_IP_NF_NAT_MODULE)
158 /* Previously seen (loopback)? Ignore. Do this before 157 /* Previously seen (loopback)? Ignore. Do this before
159 fragment check. */ 158 fragment check. */
160 if ((*pskb)->nfct) 159 if ((*pskb)->nfct)
161 return NF_ACCEPT; 160 return NF_ACCEPT;
162#endif
163 161
164 /* Gather fragments. */ 162 /* Gather fragments. */
165 if (ip_hdr(*pskb)->frag_off & htons(IP_MF | IP_OFFSET)) { 163 if (ip_hdr(*pskb)->frag_off & htons(IP_MF | IP_OFFSET)) {
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 37ab5802ca08..cdbc6c135849 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -109,6 +109,17 @@ static const struct snmp_mib snmp4_ipstats_list[] = {
109 SNMP_MIB_SENTINEL 109 SNMP_MIB_SENTINEL
110}; 110};
111 111
112/* Following RFC4293 items are displayed in /proc/net/netstat */
113static const struct snmp_mib snmp4_ipextstats_list[] = {
114 SNMP_MIB_ITEM("InNoRoutes", IPSTATS_MIB_INNOROUTES),
115 SNMP_MIB_ITEM("InTruncatedPkts", IPSTATS_MIB_INTRUNCATEDPKTS),
116 SNMP_MIB_ITEM("InMcastPkts", IPSTATS_MIB_INMCASTPKTS),
117 SNMP_MIB_ITEM("OutMcastPkts", IPSTATS_MIB_OUTMCASTPKTS),
118 SNMP_MIB_ITEM("InBcastPkts", IPSTATS_MIB_INBCASTPKTS),
119 SNMP_MIB_ITEM("OutBcastPkts", IPSTATS_MIB_OUTBCASTPKTS),
120 SNMP_MIB_SENTINEL
121};
122
112static const struct snmp_mib snmp4_icmp_list[] = { 123static const struct snmp_mib snmp4_icmp_list[] = {
113 SNMP_MIB_ITEM("InMsgs", ICMP_MIB_INMSGS), 124 SNMP_MIB_ITEM("InMsgs", ICMP_MIB_INMSGS),
114 SNMP_MIB_ITEM("InErrors", ICMP_MIB_INERRORS), 125 SNMP_MIB_ITEM("InErrors", ICMP_MIB_INERRORS),
@@ -338,6 +349,16 @@ static int netstat_seq_show(struct seq_file *seq, void *v)
338 snmp_fold_field((void **)net_statistics, 349 snmp_fold_field((void **)net_statistics,
339 snmp4_net_list[i].entry)); 350 snmp4_net_list[i].entry));
340 351
352 seq_puts(seq, "\nIpExt:");
353 for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++)
354 seq_printf(seq, " %s", snmp4_ipextstats_list[i].name);
355
356 seq_puts(seq, "\nIpExt:");
357 for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++)
358 seq_printf(seq, " %lu",
359 snmp_fold_field((void **)ip_statistics,
360 snmp4_ipextstats_list[i].entry));
361
341 seq_putc(seq, '\n'); 362 seq_putc(seq, '\n');
342 return 0; 363 return 0;
343} 364}
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cb76e3c725a0..df9fe4f2e8cc 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2396,7 +2396,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2396 2396
2397 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ 2397 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
2398 dev_out = ip_dev_find(oldflp->fl4_src); 2398 dev_out = ip_dev_find(oldflp->fl4_src);
2399 if ((dev_out == NULL) && !(sysctl_ip_nonlocal_bind)) 2399 if (dev_out == NULL)
2400 goto out; 2400 goto out;
2401 2401
2402 /* I removed check for oif == dev_out->oif here. 2402 /* I removed check for oif == dev_out->oif here.
@@ -2407,7 +2407,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2407 of another iface. --ANK 2407 of another iface. --ANK
2408 */ 2408 */
2409 2409
2410 if (dev_out && oldflp->oif == 0 2410 if (oldflp->oif == 0
2411 && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF))) { 2411 && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF))) {
2412 /* Special hack: user can direct multicasts 2412 /* Special hack: user can direct multicasts
2413 and limited broadcast via necessary interface 2413 and limited broadcast via necessary interface
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 86b26539e54b..1260e52ad772 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -276,30 +276,34 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
276 276
277 277
278/* 278/*
279 * Slow start (exponential increase) with 279 * Slow start is used when congestion window is less than slow start
280 * RFC3742 Limited Slow Start (fast linear increase) support. 280 * threshold. This version implements the basic RFC2581 version
281 * and optionally supports:
282 * RFC3742 Limited Slow Start - growth limited to max_ssthresh
283 * RFC3465 Appropriate Byte Counting - growth limited by bytes acknowledged
281 */ 284 */
282void tcp_slow_start(struct tcp_sock *tp) 285void tcp_slow_start(struct tcp_sock *tp)
283{ 286{
284 int cnt = 0; 287 int cnt; /* increase in packets */
285 288
286 if (sysctl_tcp_abc) { 289 /* RFC3465: ABC Slow start
287 /* RFC3465: Slow Start 290 * Increase only after a full MSS of bytes is acked
288 * TCP sender SHOULD increase cwnd by the number of 291 *
289 * previously unacknowledged bytes ACKed by each incoming 292 * TCP sender SHOULD increase cwnd by the number of
290 * acknowledgment, provided the increase is not more than L 293 * previously unacknowledged bytes ACKed by each incoming
291 */ 294 * acknowledgment, provided the increase is not more than L
292 if (tp->bytes_acked < tp->mss_cache) 295 */
293 return; 296 if (sysctl_tcp_abc && tp->bytes_acked < tp->mss_cache)
294 } 297 return;
295 298
296 if (sysctl_tcp_max_ssthresh > 0 && 299 if (sysctl_tcp_max_ssthresh > 0 && tp->snd_cwnd > sysctl_tcp_max_ssthresh)
297 tp->snd_cwnd > sysctl_tcp_max_ssthresh) 300 cnt = sysctl_tcp_max_ssthresh >> 1; /* limited slow start */
298 cnt += sysctl_tcp_max_ssthresh>>1;
299 else 301 else
300 cnt += tp->snd_cwnd; 302 cnt = tp->snd_cwnd; /* exponential increase */
301 303
302 /* RFC3465: We MAY increase by 2 if discovered delayed ack */ 304 /* RFC3465: ABC
305 * We MAY increase by 2 if discovered delayed ack
306 */
303 if (sysctl_tcp_abc > 1 && tp->bytes_acked >= 2*tp->mss_cache) 307 if (sysctl_tcp_abc > 1 && tp->bytes_acked >= 2*tp->mss_cache)
304 cnt <<= 1; 308 cnt <<= 1;
305 tp->bytes_acked = 0; 309 tp->bytes_acked = 0;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 7641b2761a14..38cb25b48bf3 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1501,6 +1501,8 @@ void tcp_enter_loss(struct sock *sk, int how)
1501 tcp_set_ca_state(sk, TCP_CA_Loss); 1501 tcp_set_ca_state(sk, TCP_CA_Loss);
1502 tp->high_seq = tp->snd_nxt; 1502 tp->high_seq = tp->snd_nxt;
1503 TCP_ECN_queue_cwr(tp); 1503 TCP_ECN_queue_cwr(tp);
1504 /* Abort FRTO algorithm if one is in progress */
1505 tp->frto_counter = 0;
1504 1506
1505 clear_all_retrans_hints(tp); 1507 clear_all_retrans_hints(tp);
1506} 1508}
@@ -2608,6 +2610,7 @@ static void tcp_conservative_spur_to_response(struct tcp_sock *tp)
2608{ 2610{
2609 tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); 2611 tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
2610 tp->snd_cwnd_cnt = 0; 2612 tp->snd_cwnd_cnt = 0;
2613 TCP_ECN_queue_cwr(tp);
2611 tcp_moderate_cwnd(tp); 2614 tcp_moderate_cwnd(tp);
2612} 2615}
2613 2616
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index be0ee8a34f9b..30a5cb1b203e 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -235,7 +235,7 @@ int ip6_mc_input(struct sk_buff *skb)
235 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS); 235 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS);
236 236
237 hdr = ipv6_hdr(skb); 237 hdr = ipv6_hdr(skb);
238 deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) || 238 deliver = unlikely(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI)) ||
239 ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL); 239 ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL);
240 240
241 /* 241 /*
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 15419dd682fd..8400525177ab 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -87,7 +87,7 @@ extern int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc,
87 unsigned char *node); 87 unsigned char *node);
88extern void ipxrtr_del_routes(struct ipx_interface *intrfc); 88extern void ipxrtr_del_routes(struct ipx_interface *intrfc);
89extern int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, 89extern int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
90 struct iovec *iov, int len, int noblock); 90 struct iovec *iov, size_t len, int noblock);
91extern int ipxrtr_route_skb(struct sk_buff *skb); 91extern int ipxrtr_route_skb(struct sk_buff *skb);
92extern struct ipx_route *ipxrtr_lookup(__be32 net); 92extern struct ipx_route *ipxrtr_lookup(__be32 net);
93extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); 93extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg);
diff --git a/net/key/af_key.c b/net/key/af_key.c
index a99444142dc7..d302ddae580c 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1448,8 +1448,6 @@ static int pfkey_add(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr,
1448 int err; 1448 int err;
1449 struct km_event c; 1449 struct km_event c;
1450 1450
1451 xfrm_probe_algs();
1452
1453 x = pfkey_msg2xfrm_state(hdr, ext_hdrs); 1451 x = pfkey_msg2xfrm_state(hdr, ext_hdrs);
1454 if (IS_ERR(x)) 1452 if (IS_ERR(x))
1455 return PTR_ERR(x); 1453 return PTR_ERR(x);
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index e8b5c2d7db62..483e927a9ca4 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -298,7 +298,6 @@ static void
298destroy_conntrack(struct nf_conntrack *nfct) 298destroy_conntrack(struct nf_conntrack *nfct)
299{ 299{
300 struct nf_conn *ct = (struct nf_conn *)nfct; 300 struct nf_conn *ct = (struct nf_conn *)nfct;
301 struct nf_conn_help *help = nfct_help(ct);
302 struct nf_conntrack_l4proto *l4proto; 301 struct nf_conntrack_l4proto *l4proto;
303 typeof(nf_conntrack_destroyed) destroyed; 302 typeof(nf_conntrack_destroyed) destroyed;
304 303
@@ -309,9 +308,6 @@ destroy_conntrack(struct nf_conntrack *nfct)
309 nf_conntrack_event(IPCT_DESTROY, ct); 308 nf_conntrack_event(IPCT_DESTROY, ct);
310 set_bit(IPS_DYING_BIT, &ct->status); 309 set_bit(IPS_DYING_BIT, &ct->status);
311 310
312 if (help && help->helper && help->helper->destroy)
313 help->helper->destroy(ct);
314
315 /* To make sure we don't get any weird locking issues here: 311 /* To make sure we don't get any weird locking issues here:
316 * destroy_conntrack() MUST NOT be called with a write lock 312 * destroy_conntrack() MUST NOT be called with a write lock
317 * to nf_conntrack_lock!!! -HW */ 313 * to nf_conntrack_lock!!! -HW */
@@ -353,6 +349,10 @@ destroy_conntrack(struct nf_conntrack *nfct)
353static void death_by_timeout(unsigned long ul_conntrack) 349static void death_by_timeout(unsigned long ul_conntrack)
354{ 350{
355 struct nf_conn *ct = (void *)ul_conntrack; 351 struct nf_conn *ct = (void *)ul_conntrack;
352 struct nf_conn_help *help = nfct_help(ct);
353
354 if (help && help->helper && help->helper->destroy)
355 help->helper->destroy(ct);
356 356
357 write_lock_bh(&nf_conntrack_lock); 357 write_lock_bh(&nf_conntrack_lock);
358 /* Inside lock so preempt is disabled on module removal path. 358 /* Inside lock so preempt is disabled on module removal path.
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index a973603e3880..f3986d498b40 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -296,7 +296,7 @@ struct rfkill *rfkill_allocate(struct device *parent, enum rfkill_type type)
296 struct device *dev; 296 struct device *dev;
297 297
298 rfkill = kzalloc(sizeof(struct rfkill), GFP_KERNEL); 298 rfkill = kzalloc(sizeof(struct rfkill), GFP_KERNEL);
299 if (rfkill) 299 if (!rfkill)
300 return NULL; 300 return NULL;
301 301
302 mutex_init(&rfkill->mutex); 302 mutex_init(&rfkill->mutex);
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 269a6e17c6c4..6d7542c26e47 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -75,7 +75,7 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
75 band = res.classid; 75 band = res.classid;
76 } 76 }
77 band = TC_H_MIN(band) - 1; 77 band = TC_H_MIN(band) - 1;
78 if (band > q->bands) 78 if (band >= q->bands)
79 return q->queues[q->prio2band[0]]; 79 return q->queues[q->prio2band[0]];
80 80
81 return q->queues[band]; 81 return q->queues[band];
diff --git a/net/socket.c b/net/socket.c
index 98a8f67abbfc..f4530196a70a 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -261,8 +261,7 @@ static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
261{ 261{
262 struct socket_alloc *ei = (struct socket_alloc *)foo; 262 struct socket_alloc *ei = (struct socket_alloc *)foo;
263 263
264 if (flags & SLAB_CTOR_CONSTRUCTOR) 264 inode_init_once(&ei->vfs_inode);
265 inode_init_once(&ei->vfs_inode);
266} 265}
267 266
268static int init_inodecache(void) 267static int init_inodecache(void)
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index a2f1893bde53..5887457dc936 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -828,19 +828,17 @@ init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
828{ 828{
829 struct rpc_inode *rpci = (struct rpc_inode *) foo; 829 struct rpc_inode *rpci = (struct rpc_inode *) foo;
830 830
831 if (flags & SLAB_CTOR_CONSTRUCTOR) { 831 inode_init_once(&rpci->vfs_inode);
832 inode_init_once(&rpci->vfs_inode); 832 rpci->private = NULL;
833 rpci->private = NULL; 833 rpci->nreaders = 0;
834 rpci->nreaders = 0; 834 rpci->nwriters = 0;
835 rpci->nwriters = 0; 835 INIT_LIST_HEAD(&rpci->in_upcall);
836 INIT_LIST_HEAD(&rpci->in_upcall); 836 INIT_LIST_HEAD(&rpci->pipe);
837 INIT_LIST_HEAD(&rpci->pipe); 837 rpci->pipelen = 0;
838 rpci->pipelen = 0; 838 init_waitqueue_head(&rpci->waitq);
839 init_waitqueue_head(&rpci->waitq); 839 INIT_DELAYED_WORK(&rpci->queue_timeout,
840 INIT_DELAYED_WORK(&rpci->queue_timeout, 840 rpc_timeout_upcall_queue);
841 rpc_timeout_upcall_queue); 841 rpci->ops = NULL;
842 rpci->ops = NULL;
843 }
844} 842}
845 843
846int register_rpc_pipefs(void) 844int register_rpc_pipefs(void)
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index b011eb625e49..944d75396fb3 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -989,8 +989,6 @@ void rpc_killall_tasks(struct rpc_clnt *clnt)
989 spin_unlock(&rpc_sched_lock); 989 spin_unlock(&rpc_sched_lock);
990} 990}
991 991
992static DECLARE_MUTEX_LOCKED(rpciod_running);
993
994static void rpciod_killall(void) 992static void rpciod_killall(void)
995{ 993{
996 unsigned long flags; 994 unsigned long flags;
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index 0d35bc796d00..73075dec83c0 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -134,11 +134,7 @@ EXPORT_SYMBOL(nfsd_debug);
134EXPORT_SYMBOL(nlm_debug); 134EXPORT_SYMBOL(nlm_debug);
135#endif 135#endif
136 136
137extern int register_rpc_pipefs(void);
138extern void unregister_rpc_pipefs(void);
139extern struct cache_detail ip_map_cache, unix_gid_cache; 137extern struct cache_detail ip_map_cache, unix_gid_cache;
140extern int init_socket_xprt(void);
141extern void cleanup_socket_xprt(void);
142 138
143static int __init 139static int __init
144init_sunrpc(void) 140init_sunrpc(void)
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index 6249a9405bb8..8a72def25a34 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -347,67 +347,44 @@ static inline int calg_entries(void)
347 return ARRAY_SIZE(calg_list); 347 return ARRAY_SIZE(calg_list);
348} 348}
349 349
350/* Todo: generic iterators */ 350struct xfrm_algo_list {
351struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id) 351 struct xfrm_algo_desc *algs;
352{ 352 int entries;
353 int i; 353 u32 type;
354 354 u32 mask;
355 for (i = 0; i < aalg_entries(); i++) { 355};
356 if (aalg_list[i].desc.sadb_alg_id == alg_id) {
357 if (aalg_list[i].available)
358 return &aalg_list[i];
359 else
360 break;
361 }
362 }
363 return NULL;
364}
365EXPORT_SYMBOL_GPL(xfrm_aalg_get_byid);
366
367struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id)
368{
369 int i;
370 356
371 for (i = 0; i < ealg_entries(); i++) { 357static const struct xfrm_algo_list xfrm_aalg_list = {
372 if (ealg_list[i].desc.sadb_alg_id == alg_id) { 358 .algs = aalg_list,
373 if (ealg_list[i].available) 359 .entries = ARRAY_SIZE(aalg_list),
374 return &ealg_list[i]; 360 .type = CRYPTO_ALG_TYPE_HASH,
375 else 361 .mask = CRYPTO_ALG_TYPE_HASH_MASK | CRYPTO_ALG_ASYNC,
376 break; 362};
377 }
378 }
379 return NULL;
380}
381EXPORT_SYMBOL_GPL(xfrm_ealg_get_byid);
382 363
383struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id) 364static const struct xfrm_algo_list xfrm_ealg_list = {
384{ 365 .algs = ealg_list,
385 int i; 366 .entries = ARRAY_SIZE(ealg_list),
367 .type = CRYPTO_ALG_TYPE_BLKCIPHER,
368 .mask = CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC,
369};
386 370
387 for (i = 0; i < calg_entries(); i++) { 371static const struct xfrm_algo_list xfrm_calg_list = {
388 if (calg_list[i].desc.sadb_alg_id == alg_id) { 372 .algs = calg_list,
389 if (calg_list[i].available) 373 .entries = ARRAY_SIZE(calg_list),
390 return &calg_list[i]; 374 .type = CRYPTO_ALG_TYPE_COMPRESS,
391 else 375 .mask = CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC,
392 break; 376};
393 }
394 }
395 return NULL;
396}
397EXPORT_SYMBOL_GPL(xfrm_calg_get_byid);
398 377
399static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list, 378static struct xfrm_algo_desc *xfrm_find_algo(
400 int entries, u32 type, u32 mask, 379 const struct xfrm_algo_list *algo_list,
401 char *name, int probe) 380 int match(const struct xfrm_algo_desc *entry, const void *data),
381 const void *data, int probe)
402{ 382{
383 struct xfrm_algo_desc *list = algo_list->algs;
403 int i, status; 384 int i, status;
404 385
405 if (!name) 386 for (i = 0; i < algo_list->entries; i++) {
406 return NULL; 387 if (!match(list + i, data))
407
408 for (i = 0; i < entries; i++) {
409 if (strcmp(name, list[i].name) &&
410 (!list[i].compat || strcmp(name, list[i].compat)))
411 continue; 388 continue;
412 389
413 if (list[i].available) 390 if (list[i].available)
@@ -416,8 +393,8 @@ static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list,
416 if (!probe) 393 if (!probe)
417 break; 394 break;
418 395
419 status = crypto_has_alg(list[i].name, type, 396 status = crypto_has_alg(list[i].name, algo_list->type,
420 mask | CRYPTO_ALG_ASYNC); 397 algo_list->mask);
421 if (!status) 398 if (!status)
422 break; 399 break;
423 400
@@ -427,27 +404,60 @@ static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list,
427 return NULL; 404 return NULL;
428} 405}
429 406
407static int xfrm_alg_id_match(const struct xfrm_algo_desc *entry,
408 const void *data)
409{
410 return entry->desc.sadb_alg_id == (int)data;
411}
412
413struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id)
414{
415 return xfrm_find_algo(&xfrm_aalg_list, xfrm_alg_id_match,
416 (void *)alg_id, 1);
417}
418EXPORT_SYMBOL_GPL(xfrm_aalg_get_byid);
419
420struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id)
421{
422 return xfrm_find_algo(&xfrm_ealg_list, xfrm_alg_id_match,
423 (void *)alg_id, 1);
424}
425EXPORT_SYMBOL_GPL(xfrm_ealg_get_byid);
426
427struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id)
428{
429 return xfrm_find_algo(&xfrm_calg_list, xfrm_alg_id_match,
430 (void *)alg_id, 1);
431}
432EXPORT_SYMBOL_GPL(xfrm_calg_get_byid);
433
434static int xfrm_alg_name_match(const struct xfrm_algo_desc *entry,
435 const void *data)
436{
437 const char *name = data;
438
439 return name && (!strcmp(name, entry->name) ||
440 (entry->compat && !strcmp(name, entry->compat)));
441}
442
430struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe) 443struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe)
431{ 444{
432 return xfrm_get_byname(aalg_list, aalg_entries(), 445 return xfrm_find_algo(&xfrm_aalg_list, xfrm_alg_name_match, name,
433 CRYPTO_ALG_TYPE_HASH, CRYPTO_ALG_TYPE_HASH_MASK, 446 probe);
434 name, probe);
435} 447}
436EXPORT_SYMBOL_GPL(xfrm_aalg_get_byname); 448EXPORT_SYMBOL_GPL(xfrm_aalg_get_byname);
437 449
438struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe) 450struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe)
439{ 451{
440 return xfrm_get_byname(ealg_list, ealg_entries(), 452 return xfrm_find_algo(&xfrm_ealg_list, xfrm_alg_name_match, name,
441 CRYPTO_ALG_TYPE_BLKCIPHER, CRYPTO_ALG_TYPE_MASK, 453 probe);
442 name, probe);
443} 454}
444EXPORT_SYMBOL_GPL(xfrm_ealg_get_byname); 455EXPORT_SYMBOL_GPL(xfrm_ealg_get_byname);
445 456
446struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe) 457struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe)
447{ 458{
448 return xfrm_get_byname(calg_list, calg_entries(), 459 return xfrm_find_algo(&xfrm_calg_list, xfrm_alg_name_match, name,
449 CRYPTO_ALG_TYPE_COMPRESS, CRYPTO_ALG_TYPE_MASK, 460 probe);
450 name, probe);
451} 461}
452EXPORT_SYMBOL_GPL(xfrm_calg_get_byname); 462EXPORT_SYMBOL_GPL(xfrm_calg_get_byname);
453 463
diff --git a/net/xfrm/xfrm_hash.c b/net/xfrm/xfrm_hash.c
index 37643bb8768a..55ab5792af56 100644
--- a/net/xfrm/xfrm_hash.c
+++ b/net/xfrm/xfrm_hash.c
@@ -22,7 +22,8 @@ struct hlist_head *xfrm_hash_alloc(unsigned int sz)
22 n = __vmalloc(sz, GFP_KERNEL, PAGE_KERNEL); 22 n = __vmalloc(sz, GFP_KERNEL, PAGE_KERNEL);
23 else 23 else
24 n = (struct hlist_head *) 24 n = (struct hlist_head *)
25 __get_free_pages(GFP_KERNEL, get_order(sz)); 25 __get_free_pages(GFP_KERNEL | __GFP_NOWARN,
26 get_order(sz));
26 27
27 if (n) 28 if (n)
28 memset(n, 0, sz); 29 memset(n, 0, sz);
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 95271e8426a1..d0882e53b6fc 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -796,6 +796,10 @@ struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete,
796 struct hlist_head *chain; 796 struct hlist_head *chain;
797 struct hlist_node *entry; 797 struct hlist_node *entry;
798 798
799 *err = -ENOENT;
800 if (xfrm_policy_id2dir(id) != dir)
801 return NULL;
802
799 *err = 0; 803 *err = 0;
800 write_lock_bh(&xfrm_policy_lock); 804 write_lock_bh(&xfrm_policy_lock);
801 chain = xfrm_policy_byidx + idx_hash(id); 805 chain = xfrm_policy_byidx + idx_hash(id);