From: Wang Weidong <wangweidong1@huawei•com>
To: Daniel Borkmann <dborkman@redhat•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: Tue, 18 Feb 2014 09:20:58 +0800 [thread overview]
Message-ID: <5302B57A.1040806@huawei.com> (raw)
In-Reply-To: <53024266.8010700@redhat.com>
On 2014/2/18 1:09, Daniel Borkmann wrote:
> 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.
>
Sorry for that. I will fix it soon.
> Can you be more specific with "some drivers"? Any driver that
> is in the mainline tree?
>
No. My team implements a driver without considering the ethtool_ops.
So I got the problem.
>> + 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-18 1:21 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 [this message]
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=5302B57A.1040806@huawei.com \
--to=wangweidong1@huawei$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=dborkman@redhat$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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