Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339353
b: refs/heads/master
c: 52bca93
h: refs/heads/master
i:
  339351: 563da2d
v: v3
  • Loading branch information
Tejun Heo committed Nov 22, 2012
1 parent fdb54af commit fcf061d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d5759dd02af5307e71ca928be11005c08f8f967
refs/heads/master: 52bca930c913c85ed1157ebc8f9dd9bc38a8c2c3
23 changes: 11 additions & 12 deletions trunk/net/core/netprio_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,25 @@ static int extend_netdev_table(struct net_device *dev, u32 new_len)
{
size_t new_size = sizeof(struct netprio_map) +
((sizeof(u32) * new_len));
struct netprio_map *new_priomap = kzalloc(new_size, GFP_KERNEL);
struct netprio_map *old_priomap;
struct netprio_map *new = kzalloc(new_size, GFP_KERNEL);
struct netprio_map *old;

old_priomap = rtnl_dereference(dev->priomap);
old = rtnl_dereference(dev->priomap);

if (!new_priomap) {
if (!new) {
pr_warn("Unable to alloc new priomap!\n");
return -ENOMEM;
}

if (old_priomap)
memcpy(new_priomap->priomap, old_priomap->priomap,
old_priomap->priomap_len *
sizeof(old_priomap->priomap[0]));
if (old)
memcpy(new->priomap, old->priomap,
old->priomap_len * sizeof(old->priomap[0]));

new_priomap->priomap_len = new_len;
new->priomap_len = new_len;

rcu_assign_pointer(dev->priomap, new_priomap);
if (old_priomap)
kfree_rcu(old_priomap, rcu);
rcu_assign_pointer(dev->priomap, new);
if (old)
kfree_rcu(old, rcu);
return 0;
}

Expand Down

0 comments on commit fcf061d

Please sign in to comment.