From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751857AbcGRLen (ORCPT ); Mon, 18 Jul 2016 07:34:43 -0400 Received: from mail-oi0-f52.google.com ([209.85.218.52]:34422 "EHLO mail-oi0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751615AbcGRLei (ORCPT ); Mon, 18 Jul 2016 07:34:38 -0400 MIME-Version: 1.0 In-Reply-To: <20160715.232048.1780795244111833927.davem@davemloft.net> References: <1468626125-31732-1-git-send-email-f.fainelli@gmail.com> <20160715.232048.1780795244111833927.davem@davemloft.net> From: Michael Chan Date: Mon, 18 Jul 2016 04:34:37 -0700 Message-ID: Subject: Re: [PATCH net] bnxt_en: Fix potential race condition in bnxt_tx_enable() To: David Miller Cc: f.fainelli@gmail.com, Netdev , Jeffrey Huang , linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 15, 2016 at 11:20 PM, David Miller wrote: > From: Florian Fainelli > Date: Fri, 15 Jul 2016 16:42:01 -0700 > >> @@ -4599,7 +4599,9 @@ static void bnxt_tx_enable(struct bnxt *bp) >> for (i = 0; i < bp->tx_nr_rings; i++) { >> txr = &bp->tx_ring[i]; >> txq = netdev_get_tx_queue(bp->dev, i); >> + __netif_tx_lock(txq, smp_processor_id()); >> txr->dev_state = 0; >> + __netif_tx_unlock(txq); > > You're going to have to explain how this could possibly cause a > problem, because I'm pretty sure it can't. > > Either the reader sees 0, or non-zero, in this value. > > And adding locking around this assignment does not change that at all. Florian, I agree with David. The lock is not needed. The lock in bnxt_tx_disable() is also unnecessary and should be removed. Thanks.