aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2007-04-06 20:35:37 -0400
committerDavid S. Miller <davem@davemloft.net>2007-04-06 20:35:37 -0400
commitb8fa2f3a82069304acac1f9e957d491585f4f49a (patch)
tree8fc4023a131d17fc74835bf0c955280e35a3afdf
parent161980f4c6b846625efe6227420175cb41477de3 (diff)
[TG3]: Fix crash during tg3_init_one().
The driver will crash when the chip has been initialized by EFI before tg3_init_one(). In this case, the driver will call tg3_chip_reset() before allocating consistent memory. The bug is fixed by checking for tp->hw_status before accessing it during tg3_chip_reset(). Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/tg3.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 0acee9f324e9..256969e1300c 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -4834,8 +4834,10 @@ static int tg3_chip_reset(struct tg3 *tp)
4834 * sharing or irqpoll. 4834 * sharing or irqpoll.
4835 */ 4835 */
4836 tp->tg3_flags |= TG3_FLAG_CHIP_RESETTING; 4836 tp->tg3_flags |= TG3_FLAG_CHIP_RESETTING;
4837 tp->hw_status->status = 0; 4837 if (tp->hw_status) {
4838 tp->hw_status->status_tag = 0; 4838 tp->hw_status->status = 0;
4839 tp->hw_status->status_tag = 0;
4840 }
4839 tp->last_tag = 0; 4841 tp->last_tag = 0;
4840 smp_mb(); 4842 smp_mb();
4841 synchronize_irq(tp->pdev->irq); 4843 synchronize_irq(tp->pdev->irq);