From: Toshiaki Makita <makita.toshiaki@lab•ntt.co.jp>
To: Vladislav Yasevich <vyasevich@gmail•com>, netdev@vger•kernel.org
Cc: stephen@networkplumber•org, bridge@lists•linux-foundation.org,
Vladislav Yasevich <vyasevic@redhat•com>
Subject: Re: [PATCH v2 net 1/3] bridge: Add a default_pvid sysfs attribute
Date: Wed, 01 Oct 2014 15:45:56 +0900 [thread overview]
Message-ID: <542BA324.7010603@lab.ntt.co.jp> (raw)
In-Reply-To: <1412105462-340-2-git-send-email-vyasevic@redhat.com>
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@redhat•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
next prev parent reply other threads:[~2014-10-01 6:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-30 19:30 [PATCH v2 net 0/3] bridge: Add vlan filtering support for default pvid Vladislav Yasevich
2014-09-30 19:31 ` [PATCH v2 net 1/3] bridge: Add a default_pvid sysfs attribute Vladislav Yasevich
2014-10-01 6:45 ` Toshiaki Makita [this message]
2014-09-30 19:31 ` [PATCH v2 net 2/3] bridge: Simplify pvid checks Vladislav Yasevich
2014-10-01 6:50 ` Toshiaki Makita
2014-09-30 19:31 ` [PATCH v2 net 3/3] bridge: Add filtering support for default_pvid Vladislav Yasevich
2014-10-01 6:54 ` Toshiaki Makita
2014-09-30 21:07 ` [PATCH v2 net 0/3] bridge: Add vlan filtering support for default pvid David Miller
2014-09-30 23:16 ` Vlad Yasevich
2014-10-02 1:53 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=542BA324.7010603@lab.ntt.co.jp \
--to=makita.toshiaki@lab$(echo .)ntt.co.jp \
--cc=bridge@lists$(echo .)linux-foundation.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=stephen@networkplumber$(echo .)org \
--cc=vyasevic@redhat$(echo .)com \
--cc=vyasevich@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox