[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1341893650.3265.3974.camel@edumazet-glaptop>
Date: Tue, 10 Jul 2012 06:14:10 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Gao feng <gaofeng@...fujitsu.com>
Cc: nhorman@...driver.com, davem@...emloft.net,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
lizefan@...wei.com, tj@...nel.org,
Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH] net: cgroup: fix access the unallocated memory in
netprio cgroup
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 <gaofeng@...fujitsu.com>
> Cc: Neil Horman <nhorman@...driver.com>
> Cc: Eric Dumazet <edumazet@...gle.com>
> ---
> 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() ?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists