Commit 6fd1cfc0 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller
Browse files

nfp: return -EOPNOTSUPP from .ndo_get_phys_port_name for VFs



After recent change we started returning 0 from
ndo_get_phys_port_name for VFs.  The name parameter for
ndo_get_phys_port_name is not initialized by the stack so
this can lead to a crash.  We should have kept returning
-EOPNOTSUPP in the first place.

Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 874fcf1d
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -3286,11 +3286,12 @@ nfp_net_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
	if (nn->port)
		return nfp_port_get_phys_port_name(netdev, name, len);

	if (!nn->dp.is_vf) {
	if (nn->dp.is_vf)
		return -EOPNOTSUPP;

	n = snprintf(name, len, "%d", nn->id);
	if (n >= len)
		return -EINVAL;
	}

	return 0;
}