]> git.baikalelectronics.ru Git - kernel.git/commit
bridge: check iface upper dev when setting master via ioctl
authorHangbin Liu <liuhangbin@gmail.com>
Fri, 27 Apr 2018 12:59:24 +0000 (20:59 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Apr 2018 01:08:02 +0000 (21:08 -0400)
commita6f3dcc7371e287009d0611a879cefad850ea93a
tree9a6202d5f49425b55d82bdb57cb27c65a3732d59
parent6bfff364c8a40a2ff04f58d78ddf71117e31c6dd
bridge: check iface upper dev when setting master via ioctl

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@syzkaller.appspotmail.com
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_if.c