All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] bridge: check iface upper dev when setting master via ioctl
@ 2018-04-26 13:56 Hangbin Liu
  2018-04-26 14:00 ` Nikolay Aleksandrov
  2018-04-27 12:59 ` [PATCHv2 " Hangbin Liu
  0 siblings, 2 replies; 8+ messages in thread
From: Hangbin Liu @ 2018-04-26 13:56 UTC (permalink / raw)
  To: netdev; +Cc: Dmitry Vyukov, syzbot, David Miller, Hangbin Liu

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. So it would be better to return as early
as possible.

Reported-by: syzbot+de73361ee4971b6e6f75@syzkaller.appspotmail.com
Signed-off-by: Hangbin Liu <liuhangbin@gmail.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..176de8a9 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_has_any_upper_dev(dev))
 		return -EBUSY;
 
 	/* No bridging devices that dislike that (e.g. wireless) */
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-04-30  1:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 13:56 [PATCH net] bridge: check iface upper dev when setting master via ioctl Hangbin Liu
2018-04-26 14:00 ` Nikolay Aleksandrov
2018-04-26 14:22   ` Nikolay Aleksandrov
2018-04-27  1:31     ` Hangbin Liu
2018-04-27  8:33       ` Nikolay Aleksandrov
2018-04-27 12:59 ` [PATCHv2 " Hangbin Liu
2018-04-28 10:06   ` Nikolay Aleksandrov
2018-04-30  1:08   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.