From: Daniel Borkmann <dborkman@redhat.com>
To: Wang Weidong <wangweidong1@huawei.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH] ethtool: check the ethtool_ops is NULL in dev_ethtool
Date: Mon, 17 Feb 2014 18:09:58 +0100 [thread overview]
Message-ID: <53024266.8010700@redhat.com> (raw)
In-Reply-To: <5301F32C.4040704@huawei.com>
On 02/17/2014 12:31 PM, Wang Weidong wrote:
> some drivers maybe not implement the ethtool_ops with only
> set NULL. So when call the ethtool cmds will lead to a
> 'NULL pointer dereference'.
>
> So add a checking in dev_ethtool.
>
> Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
> ---
> net/core/ethtool.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 30071de..f418dcb 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -1499,6 +1499,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
> if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
> return -EPERM;
> }
> +
You have a trailing whitespace/tab in the line above. Please
use checkpatch for detecting such things.
Can you be more specific with "some drivers"? Any driver that
is in the mainline tree?
> + if (!dev->ethtool_ops)
> + return -EOPNOTSUPP;
>
> if (dev->ethtool_ops->begin) {
> rc = dev->ethtool_ops->begin(dev);
>
next prev parent reply other threads:[~2014-02-17 17:10 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 [this message]
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
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=53024266.8010700@redhat.com \
--to=dborkman@redhat.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=wangweidong1@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.