History

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.

Jakub Kicinski committed 5 years ago

Commit d3b37fc1 parent 240e1142 files · +2 −1Browse files

Unified · Split

2 files
  1. include/uapi/linux/ethtool.h +1 −1
  2. net/ethtool/ioctl.c +1 −0
include/uapi/linux/ethtool.h+1−1
@@ -1378,7 +1378,7 @@ struct ethtool_per_queue_op { · 1377 unmodified lines
1378/**1378/**
1379 * struct ethtool_fecparam - Ethernet forward error correction(fec) parameters1379 * struct ethtool_fecparam - Ethernet forward error correction(fec) parameters
1380 * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM1380 * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM
1381 * @active_fec: FEC mode which is active on the port1381 * @active_fec: FEC mode which is active on the port, GET only.
1382 * @fec: Bitmask of supported/configured FEC modes1382 * @fec: Bitmask of supported/configured FEC modes
1383 * @reserved: Reserved for future extensions, ignore on GET, write 0 for SET.1383 * @reserved: Reserved for future extensions, ignore on GET, write 0 for SET.
1384 */1384 */
net/ethtool/ioctl.c+1−0
@@ -2586,6 +2586,7 @@ static int ethtool_set_fecparam(struct net_device *dev, void __user *useraddr) · 2585 unmodified lines
2586 if (copy_from_user(&fecparam, useraddr, sizeof(fecparam)))2586 if (copy_from_user(&fecparam, useraddr, sizeof(fecparam)))
2587 return -EFAULT;2587 return -EFAULT;
2588 2588
2589 fecparam.active_fec = 0;
2589 fecparam.reserved = 0;2590 fecparam.reserved = 0;
2590 2591
2591 return dev->ethtool_ops->set_fecparam(dev, &fecparam);2592 return dev->ethtool_ops->set_fecparam(dev, &fecparam);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t