netdevsim: don't assume core pre-populates HDS params on GET
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 netdevsim: don't assume core pre-populates HDS params on GET
Syzbot reports:
BUG: KMSAN: uninit-value in nsim_get_ringparam+0xa8/0xe0 drivers/net/netdevsim/ethtool.c:77 nsim_get_ringparam+0xa8/0xe0 drivers/net/netdevsim/ethtool.c:77 ethtool_set_ringparam+0x268/0x570 net/ethtool/ioctl.c:2072 __dev_ethtool net/ethtool/ioctl.c:3209 [inline] dev_ethtool+0x126d/0x2a40 net/ethtool/ioctl.c:3398 dev_ioctl+0xb0e/0x1280 net/core/dev_ioctl.c:759
This is the SET path, where we call GET to either check user request against max values, or check if any of the settings will change.
The logic in netdevsim is trying to report the default (ENABLED) if user has not requested any specific setting. The user setting is recorded in dev->cfg, don't depend on kernel_ringparam being pre-populated with it.
Fixes 928459bbda19 ("net: ethtool: populate the default HDS params in the core")
Reported-by Eric Dumazet <[email protected]>
Reported-by [email protected]
Tested-by [email protected]
Signed-off-by Jakub Kicinski <[email protected]>
--- drivers/net/netdevsim/ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/netdevsim/ethtool.c +1 -1
@@ -74,7 +74,7 @@ static void nsim_get_ringparam(struct net_device *dev,memcpy (ring, &ns->ethtool.ring,sizeof (ns->ethtool.ring)); kernel_ring->hds_thresh_max =NSIM_HDS_THRESHOLD_MAX ; -if (kernel_ring->tcp_data_split ==ETHTOOL_TCP_DATA_SPLIT_UNKNOWN ) +if (dev->cfg->hds_config ==ETHTOOL_TCP_DATA_SPLIT_UNKNOWN ) kernel_ring->tcp_data_split =ETHTOOL_TCP_DATA_SPLIT_ENABLED ; }
Signature · 1 line
2.48.1
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Thu, 23 Jan 2025 14:14:10 -0800 you wrote:
Syzbot reports:
BUG: KMSAN: uninit-value in nsim_get_ringparam+0xa8/0xe0 drivers/net/netdevsim/ethtool.c:77 nsim_get_ringparam+0xa8/0xe0 drivers/net/netdevsim/ethtool.c:77 ethtool_set_ringparam+0x268/0x570 net/ethtool/ioctl.c:2072 __dev_ethtool net/ethtool/ioctl.c:3209 [inline] dev_ethtool+0x126d/0x2a40 net/ethtool/ioctl.c:3398 dev_ioctl+0xb0e/0x1280 net/core/dev_ioctl.c:759[...]
Here is the summary with links:
- [net] netdevsim: don't assume core pre-populates HDS params on GET
https://git.kernel.org/netdev/net/c/6db9d3a536cd
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html