Commit eacecf27 authored by Adi Nissim's avatar Adi Nissim Committed by Saeed Mahameed

net/mlx5e: Fix null pointer access when setting MTU of vport representor

MTU helper function is used by both conventional mlx5e
instances (PF/VF) and the eswitch representors. The representor
shouldn't change the nic vport context MTU, the VF is responsible for
that. Therefore set_mtu_cb has a null value when changing the
representor MTU.

Fixes: 250a42b6 ("net/mlx5e: Support configurable MTU for vport representors")
Signed-off-by: default avatarAdi Nissim <adin@mellanox.com>
Reviewed-by: default avatarYevgeny Kliteynik <kliteyn@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 2e8e70d2
......@@ -3712,7 +3712,8 @@ int mlx5e_change_mtu(struct net_device *netdev, int new_mtu,
if (!reset) {
params->sw_mtu = new_mtu;
set_mtu_cb(priv);
if (set_mtu_cb)
set_mtu_cb(priv);
netdev->mtu = params->sw_mtu;
goto out;
}
......
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