diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 56 |
1 files changed, 17 insertions, 39 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 4d2b5167d7f5..d4a1ec3bded5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -116,6 +116,7 @@ | |||
116 | #include <linux/audit.h> | 116 | #include <linux/audit.h> |
117 | #include <linux/dmaengine.h> | 117 | #include <linux/dmaengine.h> |
118 | #include <linux/err.h> | 118 | #include <linux/err.h> |
119 | #include <linux/ctype.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) |
@@ -632,14 +633,22 @@ struct net_device * dev_get_by_flags(unsigned short if_flags, unsigned short mas | |||
632 | * @name: name string | 633 | * @name: name string |
633 | * | 634 | * |
634 | * Network device names need to be valid file names to | 635 | * Network device names need to be valid file names to |
635 | * to allow sysfs to work | 636 | * to allow sysfs to work. We also disallow any kind of |
637 | * whitespace. | ||
636 | */ | 638 | */ |
637 | int dev_valid_name(const char *name) | 639 | int dev_valid_name(const char *name) |
638 | { | 640 | { |
639 | return !(*name == '\0' | 641 | if (*name == '\0') |
640 | || !strcmp(name, ".") | 642 | return 0; |
641 | || !strcmp(name, "..") | 643 | if (!strcmp(name, ".") || !strcmp(name, "..")) |
642 | || strchr(name, '/')); | 644 | return 0; |
645 | |||
646 | while (*name) { | ||
647 | if (*name == '/' || isspace(*name)) | ||
648 | return 0; | ||
649 | name++; | ||
650 | } | ||
651 | return 1; | ||
643 | } | 652 | } |
644 | 653 | ||
645 | /** | 654 | /** |
@@ -1166,11 +1175,6 @@ int skb_checksum_help(struct sk_buff *skb, int inward) | |||
1166 | goto out_set_summed; | 1175 | goto out_set_summed; |
1167 | 1176 | ||
1168 | if (unlikely(skb_shinfo(skb)->gso_size)) { | 1177 | if (unlikely(skb_shinfo(skb)->gso_size)) { |
1169 | static int warned; | ||
1170 | |||
1171 | WARN_ON(!warned); | ||
1172 | warned = 1; | ||
1173 | |||
1174 | /* Let GSO fix up the checksum. */ | 1178 | /* Let GSO fix up the checksum. */ |
1175 | goto out_set_summed; | 1179 | goto out_set_summed; |
1176 | } | 1180 | } |
@@ -1220,11 +1224,6 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features) | |||
1220 | __skb_pull(skb, skb->mac_len); | 1224 | __skb_pull(skb, skb->mac_len); |
1221 | 1225 | ||
1222 | if (unlikely(skb->ip_summed != CHECKSUM_HW)) { | 1226 | if (unlikely(skb->ip_summed != CHECKSUM_HW)) { |
1223 | static int warned; | ||
1224 | |||
1225 | WARN_ON(!warned); | ||
1226 | warned = 1; | ||
1227 | |||
1228 | if (skb_header_cloned(skb) && | 1227 | if (skb_header_cloned(skb) && |
1229 | (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) | 1228 | (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) |
1230 | return ERR_PTR(err); | 1229 | return ERR_PTR(err); |
@@ -1629,26 +1628,10 @@ static inline struct net_device *skb_bond(struct sk_buff *skb) | |||
1629 | struct net_device *dev = skb->dev; | 1628 | struct net_device *dev = skb->dev; |
1630 | 1629 | ||
1631 | if (dev->master) { | 1630 | if (dev->master) { |
1632 | /* | 1631 | if (skb_bond_should_drop(skb)) { |
1633 | * On bonding slaves other than the currently active | ||
1634 | * slave, suppress duplicates except for 802.3ad | ||
1635 | * ETH_P_SLOW and alb non-mcast/bcast. | ||
1636 | */ | ||
1637 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { | ||
1638 | if (dev->master->priv_flags & IFF_MASTER_ALB) { | ||
1639 | if (skb->pkt_type != PACKET_BROADCAST && | ||
1640 | skb->pkt_type != PACKET_MULTICAST) | ||
1641 | goto keep; | ||
1642 | } | ||
1643 | |||
1644 | if (dev->master->priv_flags & IFF_MASTER_8023AD && | ||
1645 | skb->protocol == __constant_htons(ETH_P_SLOW)) | ||
1646 | goto keep; | ||
1647 | |||
1648 | kfree_skb(skb); | 1632 | kfree_skb(skb); |
1649 | return NULL; | 1633 | return NULL; |
1650 | } | 1634 | } |
1651 | keep: | ||
1652 | skb->dev = dev->master; | 1635 | skb->dev = dev->master; |
1653 | } | 1636 | } |
1654 | 1637 | ||
@@ -3429,12 +3412,9 @@ static void net_dma_rebalance(void) | |||
3429 | unsigned int cpu, i, n; | 3412 | unsigned int cpu, i, n; |
3430 | struct dma_chan *chan; | 3413 | struct dma_chan *chan; |
3431 | 3414 | ||
3432 | lock_cpu_hotplug(); | ||
3433 | |||
3434 | if (net_dma_count == 0) { | 3415 | if (net_dma_count == 0) { |
3435 | for_each_online_cpu(cpu) | 3416 | for_each_online_cpu(cpu) |
3436 | rcu_assign_pointer(per_cpu(softnet_data.net_dma, cpu), NULL); | 3417 | rcu_assign_pointer(per_cpu(softnet_data, cpu).net_dma, NULL); |
3437 | unlock_cpu_hotplug(); | ||
3438 | return; | 3418 | return; |
3439 | } | 3419 | } |
3440 | 3420 | ||
@@ -3447,15 +3427,13 @@ static void net_dma_rebalance(void) | |||
3447 | + (i < (num_online_cpus() % net_dma_count) ? 1 : 0)); | 3427 | + (i < (num_online_cpus() % net_dma_count) ? 1 : 0)); |
3448 | 3428 | ||
3449 | while(n) { | 3429 | while(n) { |
3450 | per_cpu(softnet_data.net_dma, cpu) = chan; | 3430 | per_cpu(softnet_data, cpu).net_dma = chan; |
3451 | cpu = next_cpu(cpu, cpu_online_map); | 3431 | cpu = next_cpu(cpu, cpu_online_map); |
3452 | n--; | 3432 | n--; |
3453 | } | 3433 | } |
3454 | i++; | 3434 | i++; |
3455 | } | 3435 | } |
3456 | rcu_read_unlock(); | 3436 | rcu_read_unlock(); |
3457 | |||
3458 | unlock_cpu_hotplug(); | ||
3459 | } | 3437 | } |
3460 | 3438 | ||
3461 | /** | 3439 | /** |