summaryrefslogtreecommitdiffstats
path: root/net/core/ethtool.c
diff options
context:
space:
mode:
authorRoger Luethi <rl@hellgate.ch>2011-03-17 06:37:21 +0000
committerDavid S. Miller <davem@davemloft.net>2011-03-18 15:13:10 -0700
commit5e5069b41d5b82bcadc1dbf73f48476b428c102f (patch)
treedd7e2eb386328b0c94ef939d27540c10f11df8e2 /net/core/ethtool.c
parent67c5c6cb8129c595f21e88254a3fc6b3b841ae8e (diff)
downloadlinux-5e5069b41d5b82bcadc1dbf73f48476b428c102f.tar.gz
linux-5e5069b41d5b82bcadc1dbf73f48476b428c102f.tar.bz2
linux-5e5069b41d5b82bcadc1dbf73f48476b428c102f.zip
ethtool: __ethtool_set_sg: check for function pointer before using it
__ethtool_set_sg does not check if dev->ethtool_ops->set_sg is defined which can result in a NULL pointer dereference when ethtool is used to change SG settings for drivers without SG support. Signed-off-by: Roger Luethi <rl@hellgate.ch> Reviewed-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/ethtool.c')
-rw-r--r--net/core/ethtool.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index c1a71bb738da..a1086fb0c0c7 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1457,6 +1457,9 @@ static int __ethtool_set_sg(struct net_device *dev, u32 data)
{
int err;
+ if (!dev->ethtool_ops->set_sg)
+ return -EOPNOTSUPP;
+
if (data && !(dev->features & NETIF_F_ALL_CSUM))
return -EINVAL;