[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201109081825.31065.arnd@arndb.de>
Date: Thu, 8 Sep 2011 18:25:30 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Roopa Prabhu <roprabhu@...co.com>
Cc: netdev@...r.kernel.org, dragos.tatulea@...il.com, mst@...hat.com,
dwang2@...co.com, benve@...co.com, kaber@...sh.net, sri@...ibm.com
Subject: Re: [net-next-2.6 PATCH 3/3 RFC] macvtap: Add support for TUNSETTXFILTER
On Wednesday 07 September 2011, Roopa Prabhu wrote:
> From: Roopa Prabhu <roprabhu@...co.com>
>
> This patch adds support for TUNSETTXFILTER. Calls macvlan set filter function
> with address list and flags received via TUNSETTXFILTER.
>
> Signed-off-by: Roopa Prabhu <roprabhu@...co.com>
> Signed-off-by: Christian Benvenuti <benve@...co.com>
> Signed-off-by: David Wang <dwang2@...co.com>
Looks ok to me in principle, but
> + /* XXX: If broadcast address present, set IFF_BROADCAST */
> + /* XXX: If multicast address present, set IFF_MULTICAST */
> + flags |= (tf.flags & TUN_FLT_ALLMULTI ? IFF_ALLMULTI : 0) |
> + (!tf.count ? IFF_PROMISC : 0);
> + ret = 0;
> + if (tf.count > 0) {
> + alen = ETH_ALEN * tf.count;
> + addrs = kmalloc(alen, GFP_KERNEL);
> + if (!addrs) {
> + dev_put(vlan->dev);
> + return -ENOMEM;
> + }
I think you need to check tf.count for a maximum value. In theory, a user
could pass a rather large number (65536) which is not good.
Also the TUNSETTXFILTER code looks sufficiently large that it would be
better to put it into a separate function. Use "goto" statements in
order to do the error handling in there, instead of repeating
lots of kfree and dev_put calls in each error case.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists