]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ethtool: rss: Fix hfunc and input_xfrm parsing on big endian
authorGal Pressman <gal@nvidia.com>
Mon, 6 Jul 2026 05:50:17 +0000 (08:50 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 9 Jul 2026 09:38:30 +0000 (11:38 +0200)
commitb62869a81a7ce388d1fbb0fac5fa8300ea614d81
treed5c75ce06acb2855385de87132a2d45e3bb873ec
parentc914307e1d41c2cb7bcdcbfde4cd2f214f6aa027
ethtool: rss: Fix hfunc and input_xfrm parsing on big endian

ETHTOOL_A_RSS_HFUNC and ETHTOOL_A_RSS_INPUT_XFRM are NLA_U32 attributes,
but ethnl_rss_set() and ethnl_rss_create_doit() parse them with
ethnl_update_u8(), which reads a single byte.

On little endian this happens to read the least significant byte and
works as long as the value fits in a byte. On big endian it reads the
most significant byte, so the requested value is parsed incorrectly.

The destination fields in struct ethtool_rxfh_param are u8, so the
attribute can't be read directly with ethnl_update_u32().
Cap the hfunc policy at U8_MAX so an out of range value is rejected
instead of being silently truncated into the u8 field, and add
ethnl_update_u8_u32() to read the full u32 and narrow it into the u8
destination.

Fixes: 82ae67cbc423 ("ethtool: rss: support setting hfunc via Netlink")
Fixes: d3e2c7bab124 ("ethtool: rss: support setting input-xfrm via Netlink")
Fixes: a166ab7816c5 ("ethtool: rss: support creating contexts via Netlink")
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
Link: https://patch.msgid.link/20260706055017.3355806-1-gal@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/ethtool/netlink.h
net/ethtool/rss.c