aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/netprio_cgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/netprio_cgroup.c')
-rw-r--r--net/core/netprio_cgroup.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index 5b8aa2fae48b..3e953eaddbfc 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -49,8 +49,9 @@ static int get_prioidx(u32 *prio)
49 return -ENOSPC; 49 return -ENOSPC;
50 } 50 }
51 set_bit(prioidx, prioidx_map); 51 set_bit(prioidx, prioidx_map);
52 if (atomic_read(&max_prioidx) < prioidx)
53 atomic_set(&max_prioidx, prioidx);
52 spin_unlock_irqrestore(&prioidx_map_lock, flags); 54 spin_unlock_irqrestore(&prioidx_map_lock, flags);
53 atomic_set(&max_prioidx, prioidx);
54 *prio = prioidx; 55 *prio = prioidx;
55 return 0; 56 return 0;
56} 57}
@@ -141,7 +142,7 @@ static void cgrp_destroy(struct cgroup *cgrp)
141 rtnl_lock(); 142 rtnl_lock();
142 for_each_netdev(&init_net, dev) { 143 for_each_netdev(&init_net, dev) {
143 map = rtnl_dereference(dev->priomap); 144 map = rtnl_dereference(dev->priomap);
144 if (map) 145 if (map && cs->prioidx < map->priomap_len)
145 map->priomap[cs->prioidx] = 0; 146 map->priomap[cs->prioidx] = 0;
146 } 147 }
147 rtnl_unlock(); 148 rtnl_unlock();
@@ -165,7 +166,7 @@ static int read_priomap(struct cgroup *cont, struct cftype *cft,
165 rcu_read_lock(); 166 rcu_read_lock();
166 for_each_netdev_rcu(&init_net, dev) { 167 for_each_netdev_rcu(&init_net, dev) {
167 map = rcu_dereference(dev->priomap); 168 map = rcu_dereference(dev->priomap);
168 priority = map ? map->priomap[prioidx] : 0; 169 priority = (map && prioidx < map->priomap_len) ? map->priomap[prioidx] : 0;
169 cb->fill(cb, dev->name, priority); 170 cb->fill(cb, dev->name, priority);
170 } 171 }
171 rcu_read_unlock(); 172 rcu_read_unlock();