aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2012-05-03 22:46:40 -0400
committerJames Morris <james.l.morris@oracle.com>2012-05-03 22:46:40 -0400
commit898bfc1d46bd76f8ea2a0fbd239dd2073efe2aa3 (patch)
treee6e666085abe674dbf6292555961fe0a0f2e2d2f /net/core
parent08162e6a23d476544adfe1164afe9ea8b34ab859 (diff)
parent69964ea4c7b68c9399f7977aa5b9aa6539a6a98a (diff)
Merge tag 'v3.4-rc5' into next
Linux 3.4-rc5 Merge to pull in prerequisite change for Smack: 86812bb0de1a3758dc6c7aa01a763158a7c0638a Requested by Casey.
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c20
-rw-r--r--net/core/drop_monitor.c1
-rw-r--r--net/core/net_namespace.c33
-rw-r--r--net/core/skbuff.c4
4 files changed, 42 insertions, 16 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index c25d453b2803..9bb8f87c4cda 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1409,14 +1409,34 @@ EXPORT_SYMBOL(register_netdevice_notifier);
1409 * register_netdevice_notifier(). The notifier is unlinked into the 1409 * register_netdevice_notifier(). The notifier is unlinked into the
1410 * kernel structures and may then be reused. A negative errno code 1410 * kernel structures and may then be reused. A negative errno code
1411 * is returned on a failure. 1411 * is returned on a failure.
1412 *
1413 * After unregistering unregister and down device events are synthesized
1414 * for all devices on the device list to the removed notifier to remove
1415 * the need for special case cleanup code.
1412 */ 1416 */
1413 1417
1414int unregister_netdevice_notifier(struct notifier_block *nb) 1418int unregister_netdevice_notifier(struct notifier_block *nb)
1415{ 1419{
1420 struct net_device *dev;
1421 struct net *net;
1416 int err; 1422 int err;
1417 1423
1418 rtnl_lock(); 1424 rtnl_lock();
1419 err = raw_notifier_chain_unregister(&netdev_chain, nb); 1425 err = raw_notifier_chain_unregister(&netdev_chain, nb);
1426 if (err)
1427 goto unlock;
1428
1429 for_each_net(net) {
1430 for_each_netdev(net, dev) {
1431 if (dev->flags & IFF_UP) {
1432 nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
1433 nb->notifier_call(nb, NETDEV_DOWN, dev);
1434 }
1435 nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
1436 nb->notifier_call(nb, NETDEV_UNREGISTER_BATCH, dev);
1437 }
1438 }
1439unlock:
1420 rtnl_unlock(); 1440 rtnl_unlock();
1421 return err; 1441 return err;
1422} 1442}
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 7f36b38e060f..5c3c81a609e5 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -150,6 +150,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location)
150 for (i = 0; i < msg->entries; i++) { 150 for (i = 0; i < msg->entries; i++) {
151 if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) { 151 if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) {
152 msg->points[i].count++; 152 msg->points[i].count++;
153 atomic_inc(&data->dm_hit_count);
153 goto out; 154 goto out;
154 } 155 }
155 } 156 }
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 0e950fda9a0a..31a5ae51a45c 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -83,21 +83,29 @@ assign:
83 83
84static int ops_init(const struct pernet_operations *ops, struct net *net) 84static int ops_init(const struct pernet_operations *ops, struct net *net)
85{ 85{
86 int err; 86 int err = -ENOMEM;
87 void *data = NULL;
88
87 if (ops->id && ops->size) { 89 if (ops->id && ops->size) {
88 void *data = kzalloc(ops->size, GFP_KERNEL); 90 data = kzalloc(ops->size, GFP_KERNEL);
89 if (!data) 91 if (!data)
90 return -ENOMEM; 92 goto out;
91 93
92 err = net_assign_generic(net, *ops->id, data); 94 err = net_assign_generic(net, *ops->id, data);
93 if (err) { 95 if (err)
94 kfree(data); 96 goto cleanup;
95 return err;
96 }
97 } 97 }
98 err = 0;
98 if (ops->init) 99 if (ops->init)
99 return ops->init(net); 100 err = ops->init(net);
100 return 0; 101 if (!err)
102 return 0;
103
104cleanup:
105 kfree(data);
106
107out:
108 return err;
101} 109}
102 110
103static void ops_free(const struct pernet_operations *ops, struct net *net) 111static void ops_free(const struct pernet_operations *ops, struct net *net)
@@ -448,12 +456,7 @@ static void __unregister_pernet_operations(struct pernet_operations *ops)
448static int __register_pernet_operations(struct list_head *list, 456static int __register_pernet_operations(struct list_head *list,
449 struct pernet_operations *ops) 457 struct pernet_operations *ops)
450{ 458{
451 int err = 0; 459 return ops_init(ops, &init_net);
452 err = ops_init(ops, &init_net);
453 if (err)
454 ops_free(ops, &init_net);
455 return err;
456
457} 460}
458 461
459static void __unregister_pernet_operations(struct pernet_operations *ops) 462static void __unregister_pernet_operations(struct pernet_operations *ops)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index baf8d281152c..e59840010d45 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -952,9 +952,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
952 goto adjust_others; 952 goto adjust_others;
953 } 953 }
954 954
955 data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); 955 data = kmalloc(size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
956 gfp_mask);
956 if (!data) 957 if (!data)
957 goto nodata; 958 goto nodata;
959 size = SKB_WITH_OVERHEAD(ksize(data));
958 960
959 /* Copy only real data... and, alas, header. This should be 961 /* Copy only real data... and, alas, header. This should be
960 * optimized for the cases when header is void. 962 * optimized for the cases when header is void.