Patchwork [1/2,net] tg3: Avoid null pointer dereference in tg3_interrupt in netconsole mode

login
register
mail settings
Submitter Michael Chan
Date Jan. 15, 2013, 3:10 a.m.
Message ID <1358219460-5993-1-git-send-email-mchan@broadcom.com>
Download mbox | patch
Permalink /patch/211976/
State Accepted
Delegated to: David Miller
Headers show

Comments

David Miller - Jan. 15, 2013, 3:09 a.m.
From: "Michael Chan" <mchan@broadcom.com>
Date: Mon, 14 Jan 2013 19:10:59 -0800

> From: Nithin Nayak Sujir <nsujir@broadcom.com>
> 
> 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>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Chan - Jan. 15, 2013, 3:10 a.m.
From: Nithin Nayak Sujir <nsujir@broadcom.com>

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>
---
 drivers/net/ethernet/broadcom/tg3.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 78ea90c..d326d92 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)
 	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;