diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-06 08:23:39 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-06 08:23:39 -0400 |
commit | 68083e05d72d94f347293d8cc0067050ba904bfa (patch) | |
tree | 842e71365bd90866be7add181661a4039d891564 /net/core | |
parent | 7baac8b91f9871ba8cb09af84de4ae1d86d07812 (diff) | |
parent | b7279469d66b55119784b8b9529c99c1955fe747 (diff) |
Merge commit 'v2.6.26-rc9' into cpus4096
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 44 | ||||
-rw-r--r-- | net/core/fib_rules.c | 4 | ||||
-rw-r--r-- | net/core/filter.c | 1 | ||||
-rw-r--r-- | net/core/neighbour.c | 9 | ||||
-rw-r--r-- | net/core/net_namespace.c | 3 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 3 | ||||
-rw-r--r-- | net/core/skbuff.c | 22 | ||||
-rw-r--r-- | net/core/user_dma.c | 2 |
8 files changed, 61 insertions, 27 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index ee61b987f4d9..94d9d6f77e04 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -119,6 +119,7 @@ | |||
119 | #include <linux/err.h> | 119 | #include <linux/err.h> |
120 | #include <linux/ctype.h> | 120 | #include <linux/ctype.h> |
121 | #include <linux/if_arp.h> | 121 | #include <linux/if_arp.h> |
122 | #include <linux/if_vlan.h> | ||
122 | 123 | ||
123 | #include "net-sysfs.h" | 124 | #include "net-sysfs.h" |
124 | 125 | ||
@@ -453,7 +454,7 @@ static int netdev_boot_setup_add(char *name, struct ifmap *map) | |||
453 | for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) { | 454 | for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) { |
454 | if (s[i].name[0] == '\0' || s[i].name[0] == ' ') { | 455 | if (s[i].name[0] == '\0' || s[i].name[0] == ' ') { |
455 | memset(s[i].name, 0, sizeof(s[i].name)); | 456 | memset(s[i].name, 0, sizeof(s[i].name)); |
456 | strcpy(s[i].name, name); | 457 | strlcpy(s[i].name, name, IFNAMSIZ); |
457 | memcpy(&s[i].map, map, sizeof(s[i].map)); | 458 | memcpy(&s[i].map, map, sizeof(s[i].map)); |
458 | break; | 459 | break; |
459 | } | 460 | } |
@@ -478,7 +479,7 @@ int netdev_boot_setup_check(struct net_device *dev) | |||
478 | 479 | ||
479 | for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) { | 480 | for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) { |
480 | if (s[i].name[0] != '\0' && s[i].name[0] != ' ' && | 481 | if (s[i].name[0] != '\0' && s[i].name[0] != ' ' && |
481 | !strncmp(dev->name, s[i].name, strlen(s[i].name))) { | 482 | !strcmp(dev->name, s[i].name)) { |
482 | dev->irq = s[i].map.irq; | 483 | dev->irq = s[i].map.irq; |
483 | dev->base_addr = s[i].map.base_addr; | 484 | dev->base_addr = s[i].map.base_addr; |
484 | dev->mem_start = s[i].map.mem_start; | 485 | dev->mem_start = s[i].map.mem_start; |
@@ -1362,6 +1363,29 @@ void netif_device_attach(struct net_device *dev) | |||
1362 | } | 1363 | } |
1363 | EXPORT_SYMBOL(netif_device_attach); | 1364 | EXPORT_SYMBOL(netif_device_attach); |
1364 | 1365 | ||
1366 | static bool can_checksum_protocol(unsigned long features, __be16 protocol) | ||
1367 | { | ||
1368 | return ((features & NETIF_F_GEN_CSUM) || | ||
1369 | ((features & NETIF_F_IP_CSUM) && | ||
1370 | protocol == htons(ETH_P_IP)) || | ||
1371 | ((features & NETIF_F_IPV6_CSUM) && | ||
1372 | protocol == htons(ETH_P_IPV6))); | ||
1373 | } | ||
1374 | |||
1375 | static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb) | ||
1376 | { | ||
1377 | if (can_checksum_protocol(dev->features, skb->protocol)) | ||
1378 | return true; | ||
1379 | |||
1380 | if (skb->protocol == htons(ETH_P_8021Q)) { | ||
1381 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; | ||
1382 | if (can_checksum_protocol(dev->features & dev->vlan_features, | ||
1383 | veh->h_vlan_encapsulated_proto)) | ||
1384 | return true; | ||
1385 | } | ||
1386 | |||
1387 | return false; | ||
1388 | } | ||
1365 | 1389 | ||
1366 | /* | 1390 | /* |
1367 | * Invalidate hardware checksum when packet is to be mangled, and | 1391 | * Invalidate hardware checksum when packet is to be mangled, and |
@@ -1640,14 +1664,8 @@ int dev_queue_xmit(struct sk_buff *skb) | |||
1640 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1664 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1641 | skb_set_transport_header(skb, skb->csum_start - | 1665 | skb_set_transport_header(skb, skb->csum_start - |
1642 | skb_headroom(skb)); | 1666 | skb_headroom(skb)); |
1643 | 1667 | if (!dev_can_checksum(dev, skb) && skb_checksum_help(skb)) | |
1644 | if (!(dev->features & NETIF_F_GEN_CSUM) && | 1668 | goto out_kfree_skb; |
1645 | !((dev->features & NETIF_F_IP_CSUM) && | ||
1646 | skb->protocol == htons(ETH_P_IP)) && | ||
1647 | !((dev->features & NETIF_F_IPV6_CSUM) && | ||
1648 | skb->protocol == htons(ETH_P_IPV6))) | ||
1649 | if (skb_checksum_help(skb)) | ||
1650 | goto out_kfree_skb; | ||
1651 | } | 1669 | } |
1652 | 1670 | ||
1653 | gso: | 1671 | gso: |
@@ -2059,6 +2077,10 @@ int netif_receive_skb(struct sk_buff *skb) | |||
2059 | 2077 | ||
2060 | rcu_read_lock(); | 2078 | rcu_read_lock(); |
2061 | 2079 | ||
2080 | /* Don't receive packets in an exiting network namespace */ | ||
2081 | if (!net_alive(dev_net(skb->dev))) | ||
2082 | goto out; | ||
2083 | |||
2062 | #ifdef CONFIG_NET_CLS_ACT | 2084 | #ifdef CONFIG_NET_CLS_ACT |
2063 | if (skb->tc_verd & TC_NCLS) { | 2085 | if (skb->tc_verd & TC_NCLS) { |
2064 | skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); | 2086 | skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); |
@@ -2951,7 +2973,7 @@ EXPORT_SYMBOL(dev_unicast_delete); | |||
2951 | /** | 2973 | /** |
2952 | * dev_unicast_add - add a secondary unicast address | 2974 | * dev_unicast_add - add a secondary unicast address |
2953 | * @dev: device | 2975 | * @dev: device |
2954 | * @addr: address to delete | 2976 | * @addr: address to add |
2955 | * @alen: length of @addr | 2977 | * @alen: length of @addr |
2956 | * | 2978 | * |
2957 | * Add a secondary unicast address to the device or increase | 2979 | * Add a secondary unicast address to the device or increase |
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index e3e9ab0f74e3..277a2302eb3a 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -226,7 +226,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
226 | 226 | ||
227 | ops = lookup_rules_ops(net, frh->family); | 227 | ops = lookup_rules_ops(net, frh->family); |
228 | if (ops == NULL) { | 228 | if (ops == NULL) { |
229 | err = EAFNOSUPPORT; | 229 | err = -EAFNOSUPPORT; |
230 | goto errout; | 230 | goto errout; |
231 | } | 231 | } |
232 | 232 | ||
@@ -365,7 +365,7 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
365 | 365 | ||
366 | ops = lookup_rules_ops(net, frh->family); | 366 | ops = lookup_rules_ops(net, frh->family); |
367 | if (ops == NULL) { | 367 | if (ops == NULL) { |
368 | err = EAFNOSUPPORT; | 368 | err = -EAFNOSUPPORT; |
369 | goto errout; | 369 | goto errout; |
370 | } | 370 | } |
371 | 371 | ||
diff --git a/net/core/filter.c b/net/core/filter.c index 4f8369729a4e..df3744355839 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -68,7 +68,6 @@ static inline void *load_pointer(struct sk_buff *skb, int k, | |||
68 | * sk_filter - run a packet through a socket filter | 68 | * sk_filter - run a packet through a socket filter |
69 | * @sk: sock associated with &sk_buff | 69 | * @sk: sock associated with &sk_buff |
70 | * @skb: buffer to filter | 70 | * @skb: buffer to filter |
71 | * @needlock: set to 1 if the sock is not locked by caller. | ||
72 | * | 71 | * |
73 | * Run the filter code and then cut skb->data to correct size returned by | 72 | * Run the filter code and then cut skb->data to correct size returned by |
74 | * sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller | 73 | * sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 5d9d7130bd6e..65f01f71b3f3 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1714,7 +1714,8 @@ static int neightbl_fill_parms(struct sk_buff *skb, struct neigh_parms *parms) | |||
1714 | return nla_nest_end(skb, nest); | 1714 | return nla_nest_end(skb, nest); |
1715 | 1715 | ||
1716 | nla_put_failure: | 1716 | nla_put_failure: |
1717 | return nla_nest_cancel(skb, nest); | 1717 | nla_nest_cancel(skb, nest); |
1718 | return -EMSGSIZE; | ||
1718 | } | 1719 | } |
1719 | 1720 | ||
1720 | static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, | 1721 | static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, |
@@ -2057,9 +2058,9 @@ static int neigh_fill_info(struct sk_buff *skb, struct neighbour *neigh, | |||
2057 | goto nla_put_failure; | 2058 | goto nla_put_failure; |
2058 | } | 2059 | } |
2059 | 2060 | ||
2060 | ci.ndm_used = now - neigh->used; | 2061 | ci.ndm_used = jiffies_to_clock_t(now - neigh->used); |
2061 | ci.ndm_confirmed = now - neigh->confirmed; | 2062 | ci.ndm_confirmed = jiffies_to_clock_t(now - neigh->confirmed); |
2062 | ci.ndm_updated = now - neigh->updated; | 2063 | ci.ndm_updated = jiffies_to_clock_t(now - neigh->updated); |
2063 | ci.ndm_refcnt = atomic_read(&neigh->refcnt) - 1; | 2064 | ci.ndm_refcnt = atomic_read(&neigh->refcnt) - 1; |
2064 | read_unlock_bh(&neigh->lock); | 2065 | read_unlock_bh(&neigh->lock); |
2065 | 2066 | ||
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 72b4c184dd84..7c52fe277b62 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -140,6 +140,9 @@ static void cleanup_net(struct work_struct *work) | |||
140 | struct pernet_operations *ops; | 140 | struct pernet_operations *ops; |
141 | struct net *net; | 141 | struct net *net; |
142 | 142 | ||
143 | /* Be very certain incoming network packets will not find us */ | ||
144 | rcu_barrier(); | ||
145 | |||
143 | net = container_of(work, struct net, work); | 146 | net = container_of(work, struct net, work); |
144 | 147 | ||
145 | mutex_lock(&net_mutex); | 148 | mutex_lock(&net_mutex); |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index cf857c4dc7b1..a9a77216310e 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -498,7 +498,8 @@ int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics) | |||
498 | return nla_nest_end(skb, mx); | 498 | return nla_nest_end(skb, mx); |
499 | 499 | ||
500 | nla_put_failure: | 500 | nla_put_failure: |
501 | return nla_nest_cancel(skb, mx); | 501 | nla_nest_cancel(skb, mx); |
502 | return -EMSGSIZE; | ||
502 | } | 503 | } |
503 | 504 | ||
504 | int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, u32 id, | 505 | int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, u32 id, |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 5c459f2b7985..366621610e76 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1292,12 +1292,14 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset, | |||
1292 | { | 1292 | { |
1293 | unsigned int nr_pages = spd->nr_pages; | 1293 | unsigned int nr_pages = spd->nr_pages; |
1294 | unsigned int poff, plen, len, toff, tlen; | 1294 | unsigned int poff, plen, len, toff, tlen; |
1295 | int headlen, seg; | 1295 | int headlen, seg, error = 0; |
1296 | 1296 | ||
1297 | toff = *offset; | 1297 | toff = *offset; |
1298 | tlen = *total_len; | 1298 | tlen = *total_len; |
1299 | if (!tlen) | 1299 | if (!tlen) { |
1300 | error = 1; | ||
1300 | goto err; | 1301 | goto err; |
1302 | } | ||
1301 | 1303 | ||
1302 | /* | 1304 | /* |
1303 | * if the offset is greater than the linear part, go directly to | 1305 | * if the offset is greater than the linear part, go directly to |
@@ -1339,7 +1341,8 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset, | |||
1339 | * just jump directly to update and return, no point | 1341 | * just jump directly to update and return, no point |
1340 | * in going over fragments when the output is full. | 1342 | * in going over fragments when the output is full. |
1341 | */ | 1343 | */ |
1342 | if (spd_fill_page(spd, virt_to_page(p), plen, poff, skb)) | 1344 | error = spd_fill_page(spd, virt_to_page(p), plen, poff, skb); |
1345 | if (error) | ||
1343 | goto done; | 1346 | goto done; |
1344 | 1347 | ||
1345 | tlen -= plen; | 1348 | tlen -= plen; |
@@ -1369,7 +1372,8 @@ map_frag: | |||
1369 | if (!plen) | 1372 | if (!plen) |
1370 | break; | 1373 | break; |
1371 | 1374 | ||
1372 | if (spd_fill_page(spd, f->page, plen, poff, skb)) | 1375 | error = spd_fill_page(spd, f->page, plen, poff, skb); |
1376 | if (error) | ||
1373 | break; | 1377 | break; |
1374 | 1378 | ||
1375 | tlen -= plen; | 1379 | tlen -= plen; |
@@ -1382,7 +1386,10 @@ done: | |||
1382 | return 0; | 1386 | return 0; |
1383 | } | 1387 | } |
1384 | err: | 1388 | err: |
1385 | return 1; | 1389 | /* update the offset to reflect the linear part skip, if any */ |
1390 | if (!error) | ||
1391 | *offset = toff; | ||
1392 | return error; | ||
1386 | } | 1393 | } |
1387 | 1394 | ||
1388 | /* | 1395 | /* |
@@ -1445,6 +1452,7 @@ done: | |||
1445 | 1452 | ||
1446 | if (spd.nr_pages) { | 1453 | if (spd.nr_pages) { |
1447 | int ret; | 1454 | int ret; |
1455 | struct sock *sk = __skb->sk; | ||
1448 | 1456 | ||
1449 | /* | 1457 | /* |
1450 | * Drop the socket lock, otherwise we have reverse | 1458 | * Drop the socket lock, otherwise we have reverse |
@@ -1455,9 +1463,9 @@ done: | |||
1455 | * we call into ->sendpage() with the i_mutex lock held | 1463 | * we call into ->sendpage() with the i_mutex lock held |
1456 | * and networking will grab the socket lock. | 1464 | * and networking will grab the socket lock. |
1457 | */ | 1465 | */ |
1458 | release_sock(__skb->sk); | 1466 | release_sock(sk); |
1459 | ret = splice_to_pipe(pipe, &spd); | 1467 | ret = splice_to_pipe(pipe, &spd); |
1460 | lock_sock(__skb->sk); | 1468 | lock_sock(sk); |
1461 | return ret; | 1469 | return ret; |
1462 | } | 1470 | } |
1463 | 1471 | ||
diff --git a/net/core/user_dma.c b/net/core/user_dma.c index 0ad1cd57bc39..c77aff9c6eb3 100644 --- a/net/core/user_dma.c +++ b/net/core/user_dma.c | |||
@@ -75,7 +75,7 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan, | |||
75 | 75 | ||
76 | end = start + skb_shinfo(skb)->frags[i].size; | 76 | end = start + skb_shinfo(skb)->frags[i].size; |
77 | copy = end - offset; | 77 | copy = end - offset; |
78 | if ((copy = end - offset) > 0) { | 78 | if (copy > 0) { |
79 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 79 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
80 | struct page *page = frag->page; | 80 | struct page *page = frag->page; |
81 | 81 | ||