From: Michael Chan <[email protected]>
Date: Thu, 3 May 2018 20:04:27 -0400
> tg3_free_consistent() calls dma_free_coherent() to free tp->hw_stats
> under spinlock and can trigger BUG_ON() in vunmap() because vunmap()
> may sleep. Fix it by removing the spinlock and relying on the
> TG3_FLAG_INIT_COMPLETE flag to prevent race conditions between
> tg3_get_stats64() and tg3_free_consistent(). TG3_FLAG_INIT_COMPLETE
> is always cleared under tp->lock before tg3_free_consistent()
> and therefore tg3_get_stats64() can safely access tp->hw_stats
> under tp->lock if TG3_FLAG_INIT_COMPLETE is set.
>
> Fixes: f5992b72ebe0 ("tg3: Fix race condition in tg3_get_stats64().")
> Reported-by: Zumeng Chen <[email protected]>
> Signed-off-by: Michael Chan <[email protected]>
Applied and queued up for -stable, thanks.