Commit b8fa2f3a authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

[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: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 161980f4
...@@ -4834,8 +4834,10 @@ static int tg3_chip_reset(struct tg3 *tp) ...@@ -4834,8 +4834,10 @@ static int tg3_chip_reset(struct tg3 *tp)
* sharing or irqpoll. * sharing or irqpoll.
*/ */
tp->tg3_flags |= TG3_FLAG_CHIP_RESETTING; tp->tg3_flags |= TG3_FLAG_CHIP_RESETTING;
if (tp->hw_status) {
tp->hw_status->status = 0; tp->hw_status->status = 0;
tp->hw_status->status_tag = 0; tp->hw_status->status_tag = 0;
}
tp->last_tag = 0; tp->last_tag = 0;
smp_mb(); smp_mb();
synchronize_irq(tp->pdev->irq); synchronize_irq(tp->pdev->irq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment