]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
tg3: Avoid null pointer dereference in tg3_interrupt in netconsole mode
authorNithin Nayak Sujir <nsujir@broadcom.com>
Mon, 14 Jan 2013 17:10:59 +0000 (17:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Jan 2013 03:09:29 +0000 (22:09 -0500)
When netconsole is enabled, logging messages generated during tg3_open
can result in a null pointer dereference for the uninitialized tg3
status block. Use the irq_sync flag to disable polling in the early
stages. irq_sync is cleared when the driver is enabling interrupts after
all initialization is completed.

Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/tg3.c

index 78ea90c40e1902af09272a80b09010da52ae6c6b..d326d9219aa898f4de34278ea5d1516c869a0347 100644 (file)
@@ -6950,6 +6950,9 @@ static void tg3_poll_controller(struct net_device *dev)
        int i;
        struct tg3 *tp = netdev_priv(dev);
 
+       if (tg3_irq_sync(tp))
+               return;
+
        for (i = 0; i < tp->irq_cnt; i++)
                tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]);
 }
@@ -16367,6 +16370,7 @@ static int tg3_init_one(struct pci_dev *pdev,
        tp->pm_cap = pm_cap;
        tp->rx_mode = TG3_DEF_RX_MODE;
        tp->tx_mode = TG3_DEF_TX_MODE;
+       tp->irq_sync = 1;
 
        if (tg3_debug > 0)
                tp->msg_enable = tg3_debug;