Skip to content

Commit

Permalink
r8169: reject unsupported WoL options
Browse files Browse the repository at this point in the history
So far unsupported WoL options are silently ignored. Change this and
reject attempts to set unsupported options. This prevents situations
where a user tries to set an unsupported WoL option and is under the
impression it was successful because ethtool doesn't complain.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Heiner Kallweit authored and David S. Miller committed Jun 26, 2018
1 parent 99672eb commit 2f533f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/ethernet/realtek/r8169.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,11 +1712,14 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
struct rtl8169_private *tp = netdev_priv(dev);
struct device *d = tp_to_dev(tp);

if (wol->wolopts & ~WAKE_ANY)
return -EINVAL;

pm_runtime_get_noresume(d);

rtl_lock_work(tp);

tp->saved_wolopts = wol->wolopts & WAKE_ANY;
tp->saved_wolopts = wol->wolopts;

if (pm_runtime_active(d))
__rtl8169_set_wol(tp, tp->saved_wolopts);
Expand Down

0 comments on commit 2f533f6

Please sign in to comment.