diff options
author | David S. Miller <davem@davemloft.net> | 2012-07-19 14:17:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-19 14:17:30 -0400 |
commit | abaa72d7fd9a20a67b62e6afa0e746e27851dc33 (patch) | |
tree | ebe4134fcc93a6e205e6004b3e652d7a62281651 /net | |
parent | 67da22d23fa6f3324e03bcd0580b914b2e4afbf3 (diff) | |
parent | 3e4b9459fb0e149c6b74c9e89399a8fc39a92b44 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
Diffstat (limited to 'net')
-rw-r--r-- | net/ax25/af_ax25.c | 1 | ||||
-rw-r--r-- | net/caif/caif_dev.c | 2 | ||||
-rw-r--r-- | net/core/dev.c | 3 | ||||
-rw-r--r-- | net/core/net_namespace.c | 4 | ||||
-rw-r--r-- | net/core/netprio_cgroup.c | 71 | ||||
-rw-r--r-- | net/core/skbuff.c | 2 | ||||
-rw-r--r-- | net/ipv4/cipso_ipv4.c | 6 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_ctl.c | 5 | ||||
-rw-r--r-- | net/sched/sch_sfb.c | 2 | ||||
-rw-r--r-- | net/sctp/input.c | 7 | ||||
-rw-r--r-- | net/sctp/socket.c | 12 |
11 files changed, 83 insertions, 32 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 051f7abae66d..779095ded689 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -842,6 +842,7 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol, | |||
842 | case AX25_P_NETROM: | 842 | case AX25_P_NETROM: |
843 | if (ax25_protocol_is_registered(AX25_P_NETROM)) | 843 | if (ax25_protocol_is_registered(AX25_P_NETROM)) |
844 | return -ESOCKTNOSUPPORT; | 844 | return -ESOCKTNOSUPPORT; |
845 | break; | ||
845 | #endif | 846 | #endif |
846 | #ifdef CONFIG_ROSE_MODULE | 847 | #ifdef CONFIG_ROSE_MODULE |
847 | case AX25_P_ROSE: | 848 | case AX25_P_ROSE: |
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index 551d2fd6a80d..1ae1d9cb278d 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c | |||
@@ -563,9 +563,9 @@ static int __init caif_device_init(void) | |||
563 | 563 | ||
564 | static void __exit caif_device_exit(void) | 564 | static void __exit caif_device_exit(void) |
565 | { | 565 | { |
566 | unregister_pernet_subsys(&caif_net_ops); | ||
567 | unregister_netdevice_notifier(&caif_device_notifier); | 566 | unregister_netdevice_notifier(&caif_device_notifier); |
568 | dev_remove_pack(&caif_packet_type); | 567 | dev_remove_pack(&caif_packet_type); |
568 | unregister_pernet_subsys(&caif_net_ops); | ||
569 | } | 569 | } |
570 | 570 | ||
571 | module_init(caif_device_init); | 571 | module_init(caif_device_init); |
diff --git a/net/core/dev.c b/net/core/dev.c index 73e87c7b4377..d70e4a3a49f2 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -6313,7 +6313,8 @@ static struct hlist_head *netdev_create_hash(void) | |||
6313 | /* Initialize per network namespace state */ | 6313 | /* Initialize per network namespace state */ |
6314 | static int __net_init netdev_init(struct net *net) | 6314 | static int __net_init netdev_init(struct net *net) |
6315 | { | 6315 | { |
6316 | INIT_LIST_HEAD(&net->dev_base_head); | 6316 | if (net != &init_net) |
6317 | INIT_LIST_HEAD(&net->dev_base_head); | ||
6317 | 6318 | ||
6318 | net->dev_name_head = netdev_create_hash(); | 6319 | net->dev_name_head = netdev_create_hash(); |
6319 | if (net->dev_name_head == NULL) | 6320 | if (net->dev_name_head == NULL) |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index dddbacb8f28c..42f1e1c7514f 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -27,7 +27,9 @@ static DEFINE_MUTEX(net_mutex); | |||
27 | LIST_HEAD(net_namespace_list); | 27 | LIST_HEAD(net_namespace_list); |
28 | EXPORT_SYMBOL_GPL(net_namespace_list); | 28 | EXPORT_SYMBOL_GPL(net_namespace_list); |
29 | 29 | ||
30 | struct net init_net; | 30 | struct net init_net = { |
31 | .dev_base_head = LIST_HEAD_INIT(init_net.dev_base_head), | ||
32 | }; | ||
31 | EXPORT_SYMBOL(init_net); | 33 | EXPORT_SYMBOL(init_net); |
32 | 34 | ||
33 | #define INITIAL_NET_GEN_PTRS 13 /* +1 for len +2 for rcu_head */ | 35 | #define INITIAL_NET_GEN_PTRS 13 /* +1 for len +2 for rcu_head */ |
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c index 3e953eaddbfc..b2e9caa1ad1a 100644 --- a/net/core/netprio_cgroup.c +++ b/net/core/netprio_cgroup.c | |||
@@ -65,7 +65,7 @@ static void put_prioidx(u32 idx) | |||
65 | spin_unlock_irqrestore(&prioidx_map_lock, flags); | 65 | spin_unlock_irqrestore(&prioidx_map_lock, flags); |
66 | } | 66 | } |
67 | 67 | ||
68 | static void extend_netdev_table(struct net_device *dev, u32 new_len) | 68 | static int extend_netdev_table(struct net_device *dev, u32 new_len) |
69 | { | 69 | { |
70 | size_t new_size = sizeof(struct netprio_map) + | 70 | size_t new_size = sizeof(struct netprio_map) + |
71 | ((sizeof(u32) * new_len)); | 71 | ((sizeof(u32) * new_len)); |
@@ -77,7 +77,7 @@ static void extend_netdev_table(struct net_device *dev, u32 new_len) | |||
77 | 77 | ||
78 | if (!new_priomap) { | 78 | if (!new_priomap) { |
79 | pr_warn("Unable to alloc new priomap!\n"); | 79 | pr_warn("Unable to alloc new priomap!\n"); |
80 | return; | 80 | return -ENOMEM; |
81 | } | 81 | } |
82 | 82 | ||
83 | for (i = 0; | 83 | for (i = 0; |
@@ -90,46 +90,79 @@ static void extend_netdev_table(struct net_device *dev, u32 new_len) | |||
90 | rcu_assign_pointer(dev->priomap, new_priomap); | 90 | rcu_assign_pointer(dev->priomap, new_priomap); |
91 | if (old_priomap) | 91 | if (old_priomap) |
92 | kfree_rcu(old_priomap, rcu); | 92 | kfree_rcu(old_priomap, rcu); |
93 | return 0; | ||
93 | } | 94 | } |
94 | 95 | ||
95 | static void update_netdev_tables(void) | 96 | static int write_update_netdev_table(struct net_device *dev) |
96 | { | 97 | { |
98 | int ret = 0; | ||
99 | u32 max_len; | ||
100 | struct netprio_map *map; | ||
101 | |||
102 | rtnl_lock(); | ||
103 | max_len = atomic_read(&max_prioidx) + 1; | ||
104 | map = rtnl_dereference(dev->priomap); | ||
105 | if (!map || map->priomap_len < max_len) | ||
106 | ret = extend_netdev_table(dev, max_len); | ||
107 | rtnl_unlock(); | ||
108 | |||
109 | return ret; | ||
110 | } | ||
111 | |||
112 | static int update_netdev_tables(void) | ||
113 | { | ||
114 | int ret = 0; | ||
97 | struct net_device *dev; | 115 | struct net_device *dev; |
98 | u32 max_len = atomic_read(&max_prioidx) + 1; | 116 | u32 max_len; |
99 | struct netprio_map *map; | 117 | struct netprio_map *map; |
100 | 118 | ||
101 | rtnl_lock(); | 119 | rtnl_lock(); |
120 | max_len = atomic_read(&max_prioidx) + 1; | ||
102 | for_each_netdev(&init_net, dev) { | 121 | for_each_netdev(&init_net, dev) { |
103 | map = rtnl_dereference(dev->priomap); | 122 | map = rtnl_dereference(dev->priomap); |
104 | if ((!map) || | 123 | /* |
105 | (map->priomap_len < max_len)) | 124 | * don't allocate priomap if we didn't |
106 | extend_netdev_table(dev, max_len); | 125 | * change net_prio.ifpriomap (map == NULL), |
126 | * this will speed up skb_update_prio. | ||
127 | */ | ||
128 | if (map && map->priomap_len < max_len) { | ||
129 | ret = extend_netdev_table(dev, max_len); | ||
130 | if (ret < 0) | ||
131 | break; | ||
132 | } | ||
107 | } | 133 | } |
108 | rtnl_unlock(); | 134 | rtnl_unlock(); |
135 | return ret; | ||
109 | } | 136 | } |
110 | 137 | ||
111 | static struct cgroup_subsys_state *cgrp_create(struct cgroup *cgrp) | 138 | static struct cgroup_subsys_state *cgrp_create(struct cgroup *cgrp) |
112 | { | 139 | { |
113 | struct cgroup_netprio_state *cs; | 140 | struct cgroup_netprio_state *cs; |
114 | int ret; | 141 | int ret = -EINVAL; |
115 | 142 | ||
116 | cs = kzalloc(sizeof(*cs), GFP_KERNEL); | 143 | cs = kzalloc(sizeof(*cs), GFP_KERNEL); |
117 | if (!cs) | 144 | if (!cs) |
118 | return ERR_PTR(-ENOMEM); | 145 | return ERR_PTR(-ENOMEM); |
119 | 146 | ||
120 | if (cgrp->parent && cgrp_netprio_state(cgrp->parent)->prioidx) { | 147 | if (cgrp->parent && cgrp_netprio_state(cgrp->parent)->prioidx) |
121 | kfree(cs); | 148 | goto out; |
122 | return ERR_PTR(-EINVAL); | ||
123 | } | ||
124 | 149 | ||
125 | ret = get_prioidx(&cs->prioidx); | 150 | ret = get_prioidx(&cs->prioidx); |
126 | if (ret != 0) { | 151 | if (ret < 0) { |
127 | pr_warn("No space in priority index array\n"); | 152 | pr_warn("No space in priority index array\n"); |
128 | kfree(cs); | 153 | goto out; |
129 | return ERR_PTR(ret); | 154 | } |
155 | |||
156 | ret = update_netdev_tables(); | ||
157 | if (ret < 0) { | ||
158 | put_prioidx(cs->prioidx); | ||
159 | goto out; | ||
130 | } | 160 | } |
131 | 161 | ||
132 | return &cs->css; | 162 | return &cs->css; |
163 | out: | ||
164 | kfree(cs); | ||
165 | return ERR_PTR(ret); | ||
133 | } | 166 | } |
134 | 167 | ||
135 | static void cgrp_destroy(struct cgroup *cgrp) | 168 | static void cgrp_destroy(struct cgroup *cgrp) |
@@ -221,13 +254,17 @@ static int write_priomap(struct cgroup *cgrp, struct cftype *cft, | |||
221 | if (!dev) | 254 | if (!dev) |
222 | goto out_free_devname; | 255 | goto out_free_devname; |
223 | 256 | ||
224 | update_netdev_tables(); | 257 | ret = write_update_netdev_table(dev); |
225 | ret = 0; | 258 | if (ret < 0) |
259 | goto out_put_dev; | ||
260 | |||
226 | rcu_read_lock(); | 261 | rcu_read_lock(); |
227 | map = rcu_dereference(dev->priomap); | 262 | map = rcu_dereference(dev->priomap); |
228 | if (map) | 263 | if (map) |
229 | map->priomap[prioidx] = priority; | 264 | map->priomap[prioidx] = priority; |
230 | rcu_read_unlock(); | 265 | rcu_read_unlock(); |
266 | |||
267 | out_put_dev: | ||
231 | dev_put(dev); | 268 | dev_put(dev); |
232 | 269 | ||
233 | out_free_devname: | 270 | out_free_devname: |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c011d7fab62d..ccfcb7d8711e 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -365,7 +365,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, | |||
365 | unsigned int fragsz = SKB_DATA_ALIGN(length + NET_SKB_PAD) + | 365 | unsigned int fragsz = SKB_DATA_ALIGN(length + NET_SKB_PAD) + |
366 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | 366 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); |
367 | 367 | ||
368 | if (fragsz <= PAGE_SIZE && !(gfp_mask & __GFP_WAIT)) { | 368 | if (fragsz <= PAGE_SIZE && !(gfp_mask & (__GFP_WAIT | GFP_DMA))) { |
369 | void *data = netdev_alloc_frag(fragsz); | 369 | void *data = netdev_alloc_frag(fragsz); |
370 | 370 | ||
371 | if (likely(data)) { | 371 | if (likely(data)) { |
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index c48adc565e92..667c1d4ca984 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c | |||
@@ -1725,8 +1725,10 @@ int cipso_v4_validate(const struct sk_buff *skb, unsigned char **option) | |||
1725 | case CIPSO_V4_TAG_LOCAL: | 1725 | case CIPSO_V4_TAG_LOCAL: |
1726 | /* This is a non-standard tag that we only allow for | 1726 | /* This is a non-standard tag that we only allow for |
1727 | * local connections, so if the incoming interface is | 1727 | * local connections, so if the incoming interface is |
1728 | * not the loopback device drop the packet. */ | 1728 | * not the loopback device drop the packet. Further, |
1729 | if (!(skb->dev->flags & IFF_LOOPBACK)) { | 1729 | * there is no legitimate reason for setting this from |
1730 | * userspace so reject it if skb is NULL. */ | ||
1731 | if (skb == NULL || !(skb->dev->flags & IFF_LOOPBACK)) { | ||
1730 | err_offset = opt_iter; | 1732 | err_offset = opt_iter; |
1731 | goto validate_return_locked; | 1733 | goto validate_return_locked; |
1732 | } | 1734 | } |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index d43e3c122f7b..84444dda194b 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -1521,11 +1521,12 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event, | |||
1521 | { | 1521 | { |
1522 | struct net_device *dev = ptr; | 1522 | struct net_device *dev = ptr; |
1523 | struct net *net = dev_net(dev); | 1523 | struct net *net = dev_net(dev); |
1524 | struct netns_ipvs *ipvs = net_ipvs(net); | ||
1524 | struct ip_vs_service *svc; | 1525 | struct ip_vs_service *svc; |
1525 | struct ip_vs_dest *dest; | 1526 | struct ip_vs_dest *dest; |
1526 | unsigned int idx; | 1527 | unsigned int idx; |
1527 | 1528 | ||
1528 | if (event != NETDEV_UNREGISTER) | 1529 | if (event != NETDEV_UNREGISTER || !ipvs) |
1529 | return NOTIFY_DONE; | 1530 | return NOTIFY_DONE; |
1530 | IP_VS_DBG(3, "%s() dev=%s\n", __func__, dev->name); | 1531 | IP_VS_DBG(3, "%s() dev=%s\n", __func__, dev->name); |
1531 | EnterFunction(2); | 1532 | EnterFunction(2); |
@@ -1551,7 +1552,7 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event, | |||
1551 | } | 1552 | } |
1552 | } | 1553 | } |
1553 | 1554 | ||
1554 | list_for_each_entry(dest, &net_ipvs(net)->dest_trash, n_list) { | 1555 | list_for_each_entry(dest, &ipvs->dest_trash, n_list) { |
1555 | __ip_vs_dev_reset(dest, dev); | 1556 | __ip_vs_dev_reset(dest, dev); |
1556 | } | 1557 | } |
1557 | mutex_unlock(&__ip_vs_mutex); | 1558 | mutex_unlock(&__ip_vs_mutex); |
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c index 74305c883bd3..30ea4674cabd 100644 --- a/net/sched/sch_sfb.c +++ b/net/sched/sch_sfb.c | |||
@@ -570,6 +570,8 @@ static int sfb_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
570 | 570 | ||
571 | sch->qstats.backlog = q->qdisc->qstats.backlog; | 571 | sch->qstats.backlog = q->qdisc->qstats.backlog; |
572 | opts = nla_nest_start(skb, TCA_OPTIONS); | 572 | opts = nla_nest_start(skb, TCA_OPTIONS); |
573 | if (opts == NULL) | ||
574 | goto nla_put_failure; | ||
573 | if (nla_put(skb, TCA_SFB_PARMS, sizeof(opt), &opt)) | 575 | if (nla_put(skb, TCA_SFB_PARMS, sizeof(opt), &opt)) |
574 | goto nla_put_failure; | 576 | goto nla_put_failure; |
575 | return nla_nest_end(skb, opts); | 577 | return nla_nest_end(skb, opts); |
diff --git a/net/sctp/input.c b/net/sctp/input.c index c201b26879a1..e64d5210ed13 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -752,15 +752,12 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint *ep) | |||
752 | 752 | ||
753 | epb = &ep->base; | 753 | epb = &ep->base; |
754 | 754 | ||
755 | if (hlist_unhashed(&epb->node)) | ||
756 | return; | ||
757 | |||
758 | epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); | 755 | epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); |
759 | 756 | ||
760 | head = &sctp_ep_hashtable[epb->hashent]; | 757 | head = &sctp_ep_hashtable[epb->hashent]; |
761 | 758 | ||
762 | sctp_write_lock(&head->lock); | 759 | sctp_write_lock(&head->lock); |
763 | __hlist_del(&epb->node); | 760 | hlist_del_init(&epb->node); |
764 | sctp_write_unlock(&head->lock); | 761 | sctp_write_unlock(&head->lock); |
765 | } | 762 | } |
766 | 763 | ||
@@ -841,7 +838,7 @@ static void __sctp_unhash_established(struct sctp_association *asoc) | |||
841 | head = &sctp_assoc_hashtable[epb->hashent]; | 838 | head = &sctp_assoc_hashtable[epb->hashent]; |
842 | 839 | ||
843 | sctp_write_lock(&head->lock); | 840 | sctp_write_lock(&head->lock); |
844 | __hlist_del(&epb->node); | 841 | hlist_del_init(&epb->node); |
845 | sctp_write_unlock(&head->lock); | 842 | sctp_write_unlock(&head->lock); |
846 | } | 843 | } |
847 | 844 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 74bd3c47350a..5d488cdcf679 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -1231,8 +1231,14 @@ out_free: | |||
1231 | SCTP_DEBUG_PRINTK("About to exit __sctp_connect() free asoc: %p" | 1231 | SCTP_DEBUG_PRINTK("About to exit __sctp_connect() free asoc: %p" |
1232 | " kaddrs: %p err: %d\n", | 1232 | " kaddrs: %p err: %d\n", |
1233 | asoc, kaddrs, err); | 1233 | asoc, kaddrs, err); |
1234 | if (asoc) | 1234 | if (asoc) { |
1235 | /* sctp_primitive_ASSOCIATE may have added this association | ||
1236 | * To the hash table, try to unhash it, just in case, its a noop | ||
1237 | * if it wasn't hashed so we're safe | ||
1238 | */ | ||
1239 | sctp_unhash_established(asoc); | ||
1235 | sctp_association_free(asoc); | 1240 | sctp_association_free(asoc); |
1241 | } | ||
1236 | return err; | 1242 | return err; |
1237 | } | 1243 | } |
1238 | 1244 | ||
@@ -1942,8 +1948,10 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1942 | goto out_unlock; | 1948 | goto out_unlock; |
1943 | 1949 | ||
1944 | out_free: | 1950 | out_free: |
1945 | if (new_asoc) | 1951 | if (new_asoc) { |
1952 | sctp_unhash_established(asoc); | ||
1946 | sctp_association_free(asoc); | 1953 | sctp_association_free(asoc); |
1954 | } | ||
1947 | out_unlock: | 1955 | out_unlock: |
1948 | sctp_release_sock(sk); | 1956 | sctp_release_sock(sk); |
1949 | 1957 | ||