netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Weidong <wangweidong1@huawei.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, Daniel Borkmann <dborkman@redhat.com>
Subject: Re: [PATCH v2] ethtool: check the ethtool_ops is NULL in dev_ethtool
Date: Tue, 18 Feb 2014 18:41:24 +0800	[thread overview]
Message-ID: <530338D4.80801@huawei.com> (raw)
In-Reply-To: <5302BAA0.9060905@huawei.com>

Just ignore it.

Regards
Wang

On 2014/2/18 9:42, Wang Weidong wrote:
> some drivers maybe not implement the ethtool_ops with only
> set NULL to ethtool_ops. So when call the ethtool devx will
> lead to a 'NULL pointer dereference'.
> 
> So add a check in dev_ethtool
> 
> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
> ---
> Change note:
> 
> v2: fix a trailing whitespace/tab pointed out by Daniel
> 
> ---
>  net/core/ethtool.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 30071de..c8cfd8f 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -1500,6 +1500,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
>  			return -EPERM;
>  	}
>  
> +	if (!dev->ethtool_ops)
> +		return -EOPNOTSUPP;
> +
>  	if (dev->ethtool_ops->begin) {
>  		rc = dev->ethtool_ops->begin(dev);
>  		if (rc  < 0)
> 

      reply	other threads:[~2014-02-18 10:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 11:31 [PATCH] ethtool: check the ethtool_ops is NULL in dev_ethtool Wang Weidong
2014-02-17 17:09 ` Daniel Borkmann
2014-02-18  1:20   ` Wang Weidong
2014-02-18  9:22     ` Daniel Borkmann
2014-02-18 10:40       ` Wang Weidong
2014-02-18  1:42 ` [PATCH v2] " Wang Weidong
2014-02-18 10:41   ` Wang Weidong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=530338D4.80801@huawei.com \
    --to=wangweidong1@huawei.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).