From: Roger Luethi <hidden> Date: 2011-03-17 16:37:21
__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 <redacted>
---
Bug verified. Patch only compile-tested.
net/core/ethtool.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
From: Ben Hutchings <hidden> Date: 2011-03-17 16:52:16
On Thu, 2011-03-17 at 17:37 +0100, Roger Luethi wrote:
__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 <redacted>
Reviewed-by: Ben Hutchings <redacted>
Michał, was this just an oversight or is there some reason why we
shouldn't check set_sg immediately?
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
From: Michał Mirosław <hidden> Date: 2011-03-17 17:01:03
2011/3/17 Roger Luethi [off-list ref]:
quoted hunk
__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 <redacted>
---
Bug verified. Patch only compile-tested.
net/core/ethtool.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
{
int err;
+ if (!dev->ethtool_ops->set_sg)
+ return -EOPNOTSUPP;
+
if (data && !(dev->features & NETIF_F_ALL_CSUM))
return -EINVAL;
Yes. __ethtool_set_sg() is the only function that was already there
before my unification series and I did tests only on drivers which had
set_sg() defined. :-/
This should go into 2.6.39 as a bugfix (adding Cc: DaveM).
Best Regards,
Michał Mirosław
From: David Miller <davem@davemloft.net> Date: 2011-03-18 22:15:21
From: Ben Hutchings <redacted>
Date: Thu, 17 Mar 2011 16:52:13 +0000
On Thu, 2011-03-17 at 17:37 +0100, Roger Luethi wrote:
quoted
__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 <redacted>