net: dsa: mv88e6xxx: Fix opps when adding vlan bridge
authorAndrew Lunn <andrew@lunn.ch>
Sun, 11 Dec 2016 20:07:19 +0000 (21:07 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Dec 2016 18:26:50 +0000 (13:26 -0500)
commit66e2809dd324f0ab5e1f9d997b40d4d31a2e42b1
treeb60dbf21d59a48e9cd0fa9944cd7b3469292082b
parente28ceeb10cd1883a4b6528c17a2b1f2024e35cad
net: dsa: mv88e6xxx: Fix opps when adding vlan bridge

A port is not necessarily assigned to a netdev. And a port does not
need to be a member of a bridge. So when iterating over all ports,
check before using the netdev and bridge_dev for a port. Otherwise we
dereference a NULL pointer.

Fixes: da9c359e19f0 ("net: dsa: mv88e6xxx: check hardware VLAN in use")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/chip.c