aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNithin Nayak Sujir <nsujir@broadcom.com>2013-01-14 12:10:59 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-14 22:09:29 -0500
commit9c13cb8bb477a83b9a3c9e5a5478a4e21294a760 (patch)
treeb4c51e4204a72e8b108aeb3ae96046427ed220df
parent47fb3a26e2f07a734876915bedc1053021fec860 (diff)
tg3: Avoid null pointer dereference in tg3_interrupt in netconsole mode
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>
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 78ea90c40e19..d326d9219aa8 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6950,6 +6950,9 @@ static void tg3_poll_controller(struct net_device *dev)
6950 int i; 6950 int i;
6951 struct tg3 *tp = netdev_priv(dev); 6951 struct tg3 *tp = netdev_priv(dev);
6952 6952
6953 if (tg3_irq_sync(tp))
6954 return;
6955
6953 for (i = 0; i < tp->irq_cnt; i++) 6956 for (i = 0; i < tp->irq_cnt; i++)
6954 tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]); 6957 tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]);
6955} 6958}
@@ -16367,6 +16370,7 @@ static int tg3_init_one(struct pci_dev *pdev,
16367 tp->pm_cap = pm_cap; 16370 tp->pm_cap = pm_cap;
16368 tp->rx_mode = TG3_DEF_RX_MODE; 16371 tp->rx_mode = TG3_DEF_RX_MODE;
16369 tp->tx_mode = TG3_DEF_TX_MODE; 16372 tp->tx_mode = TG3_DEF_TX_MODE;
16373 tp->irq_sync = 1;
16370 16374
16371 if (tg3_debug > 0) 16375 if (tg3_debug > 0)
16372 tp->msg_enable = tg3_debug; 16376 tp->msg_enable = tg3_debug;