]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
Fix a potential NULL pointer dereference in write_bulk_callback() in drivers/net...
authorMicah Gruber <micah.gruber@gmail.com>
Mon, 23 Jul 2007 08:05:52 +0000 (16:05 +0800)
committerJeff Garzik <jeff@garzik.org>
Mon, 30 Jul 2007 19:44:50 +0000 (15:44 -0400)
This patch fixes a potential null dereference bug where we dereference
pegasus before a null check. This patch simply moves the dereferencing
after the null check.

Signed-off-by: Micah Gruber <micah.gruber@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/usb/pegasus.c

index a05fd97e5bc2e0c98b67664142767501611cd293..04cba6bf3d5477ffb6678e53187cde36e724f624 100644 (file)
@@ -768,11 +768,13 @@ done:
 static void write_bulk_callback(struct urb *urb)
 {
        pegasus_t *pegasus = urb->context;
-       struct net_device *net = pegasus->net;
+       struct net_device *net;
 
        if (!pegasus)
                return;
 
+       net = pegasus->net;
+
        if (!netif_device_present(net) || !netif_running(net))
                return;