[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <542BA324.7010603@lab.ntt.co.jp>
Date: Wed, 01 Oct 2014 15:45:56 +0900
From: Toshiaki Makita <makita.toshiaki@....ntt.co.jp>
To: Vladislav Yasevich <vyasevich@...il.com>, netdev@...r.kernel.org
CC: toshiaki.makita1@...il.com, stephen@...workplumber.org,
bridge@...ts.linux-foundation.org,
Vladislav Yasevich <vyasevic@...hat.com>
Subject: Re: [PATCH v2 net 1/3] bridge: Add a default_pvid sysfs attribute
On 2014/10/01 4:31, Vladislav Yasevich wrote:
> This patch allows the user to set and retrieve default_pvid
> value. A new value can only be stored when vlan filtering
> is disabled.
>
> Signed-off-by: Vladislav Yasevich <vyasevic@...hat.com>
> ---
...
> +int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val)
> +{
> + u16 pvid = val;
> + int err = 0;
> +
> + if (!pvid || pvid >= VLAN_VID_MASK)
> + return -EINVAL;
This seems to accept a large value as a valid value.
For example, ((1 << 16) + 10) will be handled as 10.
How about using "val" for this check?
> +
> + if (!rtnl_trylock())
> + return restart_syscall();
> +
> + if (pvid == br->default_pvid)
> + goto unlock;
> +
> + /* Only allow default pvid change when filtering is disabled */
> + if (br->vlan_enabled) {
> + err = -EPERM;
Additional log message might help users know why it was rejected.
Thanks,
Toshiaki Makita
--
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