]> git.baikalelectronics.ru Git - kernel.git/commit
ethtool: fix reference leak in some *_SET handlers
authorMichal Kubecek <mkubecek@suse.cz>
Sun, 22 Mar 2020 21:24:21 +0000 (22:24 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Mar 2020 04:50:14 +0000 (21:50 -0700)
commitc5b6db031643ae9523ab04336a0a0f50c45eab26
tree100399068cdeafc3d9e050e2f52a95b0938813aa
parent3dca372c832ba79f33306b63a3fed7779507f4ea
ethtool: fix reference leak in some *_SET handlers

Andrew noticed that some handlers for *_SET commands leak a netdev
reference if required ethtool_ops callbacks do not exist. A simple
reproducer would be e.g.

  ip link add veth1 type veth peer name veth2
  ethtool -s veth1 wol g
  ip link del veth1

Make sure dev_put() is called when ethtool_ops check fails.

v2: add Fixes tags

Fixes: 44458b5c2496 ("ethtool: set link settings with LINKINFO_SET request")
Fixes: bf02cbfadf41 ("ethtool: set link modes related data with LINKMODES_SET request")
Fixes: fa06d59b376e ("ethtool: set message mask with DEBUG_SET request")
Fixes: efc443698486 ("ethtool: set wake-on-lan settings with WOL_SET request")
Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ethtool/debug.c
net/ethtool/linkinfo.c
net/ethtool/linkmodes.c
net/ethtool/wol.c