diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2009-05-10 20:36:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-17 23:37:55 -0400 |
commit | 5e392739d6ab72f7c35040aa07f4097904bce6e7 (patch) | |
tree | 3c363f0733de8f6f843280f84c68ee57695f0c39 /net | |
parent | 74392592bbf7e93ef383588e21aea0c1450d6f12 (diff) |
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/netpoll.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index b5873bdff612..64f51eec6576 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -175,9 +175,13 @@ static void service_arp_queue(struct netpoll_info *npi) | |||
175 | void netpoll_poll(struct netpoll *np) | 175 | void netpoll_poll(struct netpoll *np) |
176 | { | 176 | { |
177 | struct net_device *dev = np->dev; | 177 | struct net_device *dev = np->dev; |
178 | const struct net_device_ops *ops = dev->netdev_ops; | 178 | const struct net_device_ops *ops; |
179 | |||
180 | if (!dev || !netif_running(dev)) | ||
181 | return; | ||
179 | 182 | ||
180 | if (!dev || !netif_running(dev) || !ops->ndo_poll_controller) | 183 | ops = dev->netdev_ops; |
184 | if (!ops->ndo_poll_controller) | ||
181 | return; | 185 | return; |
182 | 186 | ||
183 | /* Process pending work on NIC */ | 187 | /* Process pending work on NIC */ |