linux/net/ethtool
Jakub Kicinski 77e80af7d2 ethtool: tsconfig: reject zero-valued tx_type and rx_filter bitsets
The ffs()/fls() guard in ethnl_set_tsconfig() was meant to enforce
that the user selects exactly one tx_type (and one rx_filter)
at a time (off / none are explicit types with non-zero values).
However, both ffs(0) and fls(0) return 0, so the guard passes
a zero-valued bitset through.

The subsequent ffs(req_tx_type) - 1 would produce -1, if user selected
no bit. net_hwtstamp_validate() catches the invalid -1 downstream,
but returns a generic error (-ERANGE) without telling the user
what went wrong. Return -EINVAL + extack instead.

Replace the ffs()/fls() comparison with a hweight32() == 1 check.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Joe Damato <joe@dama.to>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20260812162230.1837788-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-13 17:44:54 -07:00
..
bitset.c
bitset.h
cabletest.c net: ethtool: optionally skip rtnl_lock in cable test handlers 2026-06-09 10:13:05 -07:00
channels.c
cmis_cdb.c
cmis_fw_update.c
cmis.h
coalesce.c
common.c tls: remove tls_toe and the related driver 2026-06-12 16:43:10 -07:00
common.h net: ethtool: keep rtnl_lock for ops using ethtool_op_get_link() 2026-06-25 10:18:34 -07:00
debug.c
eee.c
eeprom.c
features.c
fec.c
ioctl.c net: ethtool: add KSZ87xx low-loss cable PHY tunables 2026-06-11 15:47:56 -07:00
linkinfo.c
linkmodes.c
linkstate.c
Makefile
mm.c net: ethtool: optionally skip rtnl_lock on Netlink path for GET ops 2026-06-09 10:13:04 -07:00
module_fw.h
module.c net: ethtool: optionally skip rtnl_lock in ethnl_act_module_fw_flash() 2026-06-09 10:13:05 -07:00
mse.c
netlink.c net: ethtool: optionally skip rtnl_lock on Netlink path for SET ops 2026-06-09 10:13:05 -07:00
netlink.h ethtool: rss: Fix hfunc and input_xfrm parsing on big endian 2026-07-09 11:38:30 +02:00
pause.c
phc_vclocks.c
phy.c
plca.c
privflags.c
pse-pd.c
rings.c
rss.c ethtool: rss: Fix hfunc and input_xfrm parsing on big endian 2026-07-09 11:38:30 +02:00
stats.c
strset.c
ts.h
tsconfig.c ethtool: tsconfig: reject zero-valued tx_type and rx_filter bitsets 2026-08-13 17:44:54 -07:00
tsinfo.c net: ethtool: optionally skip rtnl_lock in ethnl_tsinfo_dumpit() 2026-06-09 10:13:05 -07:00
tunnels.c
wol.c