[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTinTWDLhqURAtEanOsry=2x8QSQKZca7B7Au5mrn@mail.gmail.com>
Date: Thu, 17 Mar 2011 18:00:42 +0100
From: Michał Mirosław <mirqus@...il.com>
To: Roger Luethi <rl@...lgate.ch>
Cc: netdev@...r.kernel.org, David Miller <davem@...emloft.net>
Subject: Re: [PATCH] ethtool: __ethtool_set_sg: check for function pointer
before using it
2011/3/17 Roger Luethi <rl@...lgate.ch>:
> __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@...lgate.ch>
> ---
>
> Bug verified. Patch only compile-tested.
>
> net/core/ethtool.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index c1a71bb..a1086fb 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;
>
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists