[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20180504.125756.2143687246272518025.davem@davemloft.net>
Date: Fri, 04 May 2018 12:57:56 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: michael.chan@...adcom.com
Cc: netdev@...r.kernel.org, siva.kallam@...adcom.com,
zumeng.chen@...il.com
Subject: Re: [PATCH net] tg3: Fix vunmap() BUG_ON() triggered from
tg3_free_consistent().
From: Michael Chan <michael.chan@...adcom.com>
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 <zumeng.chen@...il.com>
> Signed-off-by: Michael Chan <michael.chan@...adcom.com>
Applied and queued up for -stable, thanks.
Powered by blists - more mailing lists