Skip to contentSkip to conversation

ethtool: ioctl: account for sopass diff in set_wol

PATCH Applied Justin Chen 3 participants 4 messages Jun 12, 2023 – Jun 14, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethtool: ioctl: account for sopass diff in set_wol

sopass won't be set if wolopt doesn't change. This means the following will fail to set the correct sopass.
ethtool -s eth0 wol s sopass 11:22:33:44:55:66
ethtool -s eth0 wol s sopass 22:44:55:66:77:88

Make sure we call into the driver layer set_wol if sopass is different.

Fixes 55b24334c0f2 ("ethtool: ioctl: improve error checking for set_wol")

---

Note: Tagged "Fixes" patch has not hit rc yet.

 net/ethtool/ioctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ethtool/ioctl.c +2 -1
index 37b582225854..4a51e0ec295c 100644
@@ -1452,7 +1452,8 @@ static int ethtool_set_wol(struct net_device *dev, char __user *useraddr)
 	if (wol.wolopts & ~cur_wol.supported)
 		return -EINVAL;
 
-	if (wol.wolopts == cur_wol.wolopts)
+	if (wol.wolopts == cur_wol.wolopts &&
+	    !memcmp(wol.sopass, cur_wol.sopass, sizeof(wol.sopass)))
 		return 0;
 
 	ret = dev->ethtool_ops->set_wol(dev, &wol);
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 7 lines · Justin Chen

sopass won't be set if wolopt doesn't change. This means the following will fail to set the correct sopass.
ethtool -s eth0 wol s sopass 11:22:33:44:55:66
ethtool -s eth0 wol s sopass 22:44:55:66:77:88

Make sure we call into the driver layer set_wol if sopass is different.

Quoted 7 lines
Fixes 55b24334c0f2 ("ethtool: ioctl: improve error checking for set_wol")

---

Note: Tagged "Fixes" patch has not hit rc yet.

 net/ethtool/ioctl.c | 3 ++-

Hi Justin

Does the netlink version get this correct?

And just for my own curiosity, why are you so interested in the ioctl version, which is deprecated and not used by modern versions of ethtool?

Andrew

#2 lore raw
Quoted 12 lines · Andrew Lunn
Quoted 11 lines · Justin Chen

sopass won't be set if wolopt doesn't change. This means the following will fail to set the correct sopass.
ethtool -s eth0 wol s sopass 11:22:33:44:55:66
ethtool -s eth0 wol s sopass 22:44:55:66:77:88

Make sure we call into the driver layer set_wol if sopass is different.

Fixes 55b24334c0f2 ("ethtool: ioctl: improve error checking for set_wol")

---

Quoted 8 lines
Quoted 3 lines

Note: Tagged "Fixes" patch has not hit rc yet.

  net/ethtool/ioctl.c | 3 ++-

Hi Justin

Does the netlink version get this correct?

Yup netlink gets this correct

Quoted 4 lines

And just for my own curiosity, why are you so interested in the ioctl version, which is deprecated and not used by modern versions of ethtool?

No particular reason. I was working on another driver and was planning to remove the set_wol error checking in the driver layer when I realized netlink set_wol was already doing it. Then on further inspection I noticed the ioctl version doesn't do the same thing.

Justin

Quoted 1 line

Andrew

#3 lore raw
In reply to Justin Chen
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 12 Jun 2023 14:37:00 -0700 you wrote:

sopass won't be set if wolopt doesn't change. This means the following will fail to set the correct sopass.
ethtool -s eth0 wol s sopass 11:22:33:44:55:66
ethtool -s eth0 wol s sopass 22:44:55:66:77:88

Make sure we call into the driver layer set_wol if sopass is different.

[...]

Here is the summary with links:
- [net-next] ethtool: ioctl: account for sopass diff in set_wol

    https://git.kernel.org/netdev/net-next/c/2bddad9ec65a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html