net: mscc: ocelot: fix NULL pointer on LAG slave removal
authorClaudiu Manoil <claudiu.manoil@nxp.com>
Tue, 5 Nov 2019 21:50:14 +0000 (23:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Nov 2019 18:20:32 +0000 (19:20 +0100)
[ Upstream commit 3b3eed8eec47259939ee6c3d58aea1c311ddee3b ]

lag_upper_info may be NULL on slave removal.

Fixes: dc96ee3730fc ("net: mscc: ocelot: add bonding support")
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mscc/ocelot.c

index ad09db4..e05a59a 100644 (file)
@@ -1550,7 +1550,8 @@ static int ocelot_netdevice_event(struct notifier_block *unused,
                struct netdev_lag_upper_info *lag_upper_info = info->upper_info;
                struct netlink_ext_ack *extack;
 
-               if (lag_upper_info->tx_type != NETDEV_LAG_TX_TYPE_HASH) {
+               if (lag_upper_info &&
+                   lag_upper_info->tx_type != NETDEV_LAG_TX_TYPE_HASH) {
                        extack = netdev_notifier_info_to_extack(&info->info);
                        NL_SET_ERR_MSG_MOD(extack, "LAG device using unsupported Tx type");