Re: [PATCH] net: cgroup: fix access the unallocated memory in netprio cgroup
From: Eric Dumazet <hidden>
Date: 2012-07-10 04:14:17
Also in:
lkml
On Tue, 2012-07-10 at 10:31 +0800, Gao feng wrote:
there are some out of bound accesses in netprio cgroup. when creating a new netprio cgroup,we only set a prioidx for the new cgroup,without allocate memory for dev->priomap. because we don't want to see additional bound checkings in fast path, so I think the best way is to allocate memory when we creating a new netprio cgroup. and because netdev can be created or registered after cgroup being created, so extend_netdev_table is also needed in write_priomap. this patch add a return value for update_netdev_tables & extend_netdev_table, so when new_priomap is allocated failed,write_priomap will stop to access the priomap,and return -ENOMEM back to the userspace to tell the user what happend. Signed-off-by: Gao feng <redacted> Cc: Neil Horman <nhorman@tuxdriver.com> Cc: Eric Dumazet <edumazet@google.com> ---
quoted hunk ↗ jump to hunk
static void cgrp_destroy(struct cgroup *cgrp)@@ -221,7 +233,10 @@ static int write_priomap(struct cgroup *cgrp, struct cftype *cft, if (!dev) goto out_free_devname; - update_netdev_tables(); + ret = update_netdev_tables(); + if (ret < 0) + goto out_free_devname; + ret = 0; rcu_read_lock(); map = rcu_dereference(dev->priomap);
Hi Gao Is it still needed to call update_netdev_tables() from write_priomap() ?