[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e92ab3a5-6a49-d41e-6eba-9087b690733c@cumulusnetworks.com>
Date: Sat, 28 Apr 2018 13:06:58 +0300
From: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
To: Hangbin Liu <liuhangbin@...il.com>, netdev@...r.kernel.org
Cc: Dmitry Vyukov <dvyukov@...gle.com>,
syzbot <syzbot+de73361ee4971b6e6f75@...kaller.appspotmail.com>,
David Miller <davem@...emloft.net>
Subject: Re: [PATCHv2 net] bridge: check iface upper dev when setting master
via ioctl
On 27/04/18 15:59, Hangbin Liu wrote:
> When we set a bond slave's master to bridge via ioctl, we only check
> the IFF_BRIDGE_PORT flag. Although we will find the slave's real master
> at netdev_master_upper_dev_link() later, it already does some settings
> and allocates some resources. It would be better to return as early
> as possible.
>
> v1 -> v2:
> use netdev_master_upper_dev_get() instead of netdev_has_any_upper_dev()
> to check if we have a master, because not all upper devs are masters,
> e.g. vlan device.
>
> Reported-by: syzbot+de73361ee4971b6e6f75@...kaller.appspotmail.com
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> ---
> net/bridge/br_if.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index 82c1a6f..5bb6681 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -518,8 +518,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
> return -ELOOP;
> }
>
> - /* Device is already being bridged */
> - if (br_port_exists(dev))
> + /* Device has master upper dev */
> + if (netdev_master_upper_dev_get(dev))
> return -EBUSY;
>
> /* No bridging devices that dislike that (e.g. wireless) */
>
Acked-by: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
Powered by blists - more mailing lists