提交 5e5069b4 编写于 作者: R Roger Luethi 提交者: David S. Miller

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: NRoger Luethi <rl@hellgate.ch>
Reviewed-by: NBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 67c5c6cb
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册