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: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Pavel Emelyanov 2009-05-11 00:36:35 +00:00 committed by David S. Miller
parent 74392592bb
commit 5e392739d6
1 changed files with 6 additions and 2 deletions

View File

@ -175,9 +175,13 @@ static void service_arp_queue(struct netpoll_info *npi)
void netpoll_poll(struct netpoll *np)
{
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) || !ops->ndo_poll_controller)
if (!dev || !netif_running(dev))
return;
ops = dev->netdev_ops;
if (!ops->ndo_poll_controller)
return;
/* Process pending work on NIC */