]> www.infradead.org Git - users/dwmw2/linux.git/commit
netdevsim: don't assume core pre-populates HDS params on GET
authorJakub Kicinski <kuba@kernel.org>
Thu, 23 Jan 2025 22:14:10 +0000 (14:14 -0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 27 Jan 2025 22:37:11 +0000 (14:37 -0800)
commit6db9d3a536cd638e2ee17cf880e14026cec19d26
treeb53d1c1a885d652d3db14d2183ed88b1820b49df
parent3b1af76604398c12cf6e54a5587cc61566680ca3
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 <edumazet@google.com>
Reported-by: syzbot+b3bcd80232d00091e061@syzkaller.appspotmail.com
Tested-by: syzbot+b3bcd80232d00091e061@syzkaller.appspotmail.com
Link: https://patch.msgid.link/20250123221410.1067678-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netdevsim/ethtool.c