Message ID | 5302BAA0.9060905@huawei.com |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
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) > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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)
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(+)