Commit 5e392739 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

netpoll: don't dereference NULL dev from np

It looks like the dev in netpoll_poll can be NULL - at lease it's
checked at the function beginning. Thus the dev->netde_ops dereference
looks dangerous.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 74392592
...@@ -175,9 +175,13 @@ static void service_arp_queue(struct netpoll_info *npi) ...@@ -175,9 +175,13 @@ static void service_arp_queue(struct netpoll_info *npi)
void netpoll_poll(struct netpoll *np) void netpoll_poll(struct netpoll *np)
{ {
struct net_device *dev = np->dev; struct net_device *dev = np->dev;
const struct net_device_ops *ops = dev->netdev_ops; const struct net_device_ops *ops;
if (!dev || !netif_running(dev))
return;
if (!dev || !netif_running(dev) || !ops->ndo_poll_controller) ops = dev->netdev_ops;
if (!ops->ndo_poll_controller)
return; return;
/* Process pending work on NIC */ /* Process pending work on NIC */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment