Commit e497ec68 authored by Talat Batheesh's avatar Talat Batheesh Committed by David S. Miller

net/mlx5: Avoid dereferencing uninitialized pointer

In NETDEV_CHANGEUPPER event the upper_info field is valid
only when linking is true. Otherwise it should be ignored.

Fixes: 7907f23a (net/mlx5: Implement RoCE LAG feature)
Signed-off-by: default avatarTalat Batheesh <talatb@mellanox.com>
Reviewed-by: default avatarAviv Heller <avivh@mellanox.com>
Reviewed-by: default avatarMoni Shoua <monis@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c2b341a6
...@@ -294,7 +294,7 @@ static int mlx5_handle_changeupper_event(struct mlx5_lag *ldev, ...@@ -294,7 +294,7 @@ static int mlx5_handle_changeupper_event(struct mlx5_lag *ldev,
struct netdev_notifier_changeupper_info *info) struct netdev_notifier_changeupper_info *info)
{ {
struct net_device *upper = info->upper_dev, *ndev_tmp; struct net_device *upper = info->upper_dev, *ndev_tmp;
struct netdev_lag_upper_info *lag_upper_info; struct netdev_lag_upper_info *lag_upper_info = NULL;
bool is_bonded; bool is_bonded;
int bond_status = 0; int bond_status = 0;
int num_slaves = 0; int num_slaves = 0;
...@@ -303,7 +303,8 @@ static int mlx5_handle_changeupper_event(struct mlx5_lag *ldev, ...@@ -303,7 +303,8 @@ static int mlx5_handle_changeupper_event(struct mlx5_lag *ldev,
if (!netif_is_lag_master(upper)) if (!netif_is_lag_master(upper))
return 0; return 0;
lag_upper_info = info->upper_info; if (info->linking)
lag_upper_info = info->upper_info;
/* The event may still be of interest if the slave does not belong to /* The event may still be of interest if the slave does not belong to
* us, but is enslaved to a master which has one or more of our netdevs * us, but is enslaved to a master which has one or more of our netdevs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment