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

ethtool: fec: sanitize ethtool_fecparam->active_fec



struct ethtool_fecparam::active_fec is a GET-only field,
all in-tree drivers correctly ignore it on SET. Clear
the field on SET to avoid any confusion. Again, we can't
reject non-zero now since ethtool user space does not
zero-init the param correctly.

Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 240e1144
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1378,7 +1378,7 @@ struct ethtool_per_queue_op {
/**
/**
 * struct ethtool_fecparam - Ethernet forward error correction(fec) parameters
 * struct ethtool_fecparam - Ethernet forward error correction(fec) parameters
 * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM
 * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM
 * @active_fec: FEC mode which is active on the port
 * @active_fec: FEC mode which is active on the port, GET only.
 * @fec: Bitmask of supported/configured FEC modes
 * @fec: Bitmask of supported/configured FEC modes
 * @reserved: Reserved for future extensions, ignore on GET, write 0 for SET.
 * @reserved: Reserved for future extensions, ignore on GET, write 0 for SET.
 */
 */
+1 −0
Original line number Original line Diff line number Diff line
@@ -2586,6 +2586,7 @@ static int ethtool_set_fecparam(struct net_device *dev, void __user *useraddr)
	if (copy_from_user(&fecparam, useraddr, sizeof(fecparam)))
	if (copy_from_user(&fecparam, useraddr, sizeof(fecparam)))
		return -EFAULT;
		return -EFAULT;


	fecparam.active_fec = 0;
	fecparam.reserved = 0;
	fecparam.reserved = 0;


	return dev->ethtool_ops->set_fecparam(dev, &fecparam);
	return dev->ethtool_ops->set_fecparam(dev, &fecparam);