From patchwork Thu Jan 21 16:48:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cox X-Patchwork-Id: 43442 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0819EB7CC1 for ; Fri, 22 Jan 2010 04:13:56 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754556Ab0AURNn (ORCPT ); Thu, 21 Jan 2010 12:13:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754549Ab0AURNn (ORCPT ); Thu, 21 Jan 2010 12:13:43 -0500 Received: from mga05.intel.com ([192.55.52.89]:43360 "EHLO fmsmga101.fm.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753801Ab0AURNm (ORCPT ); Thu, 21 Jan 2010 12:13:42 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 21 Jan 2010 09:12:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.49,318,1262592000"; d="scan'208";a="766188307" Received: from unknown (HELO localhost) ([10.254.190.84]) by fmsmga001.fm.intel.com with ESMTP; 21 Jan 2010 09:13:37 -0800 Date: Thu, 21 Jan 2010 16:48:01 +0000 From: Alan Cox To: jesse.brandeburg@intel.com, netdev@vger.kernel.org Subject: [RFC PATCH] e100: Fix workqueue race Message-ID: <20100121164801.416170b9@linux.intel.com> Organization: Intel X-Mailer: Claws Mail 3.7.3 (GTK+ 2.18.5; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org (Incidentally this doesn't seem to be the only net driver that looks suspect here) e100: Fix the TX workqueue race From: Alan Cox Nothing stops the workqueue being left to run in parallel with close or a few other operations. This causes double unmaps and the like. See kerneloops.org #1041230 for an example Signed-off-by: Alan Cox --- drivers/net/e100.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 5c7a155..5e02e4f 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -2232,7 +2232,7 @@ err_rx_clean_list: return err; } -static void e100_down(struct nic *nic) +static void e100_do_down(struct nic *nic) { /* wait here for poll to complete */ napi_disable(&nic->napi); @@ -2245,6 +2245,15 @@ static void e100_down(struct nic *nic) e100_rx_clean_list(nic); } +/* For the non TX timeout case we want to kill the tx timeout before + we do this otherwise a parallel tx timeout will make a nasty mess. */ + +static void e100_down(struct nic *nic) +{ + cancel_work_sync(&nic->tx_timeout_task); + e100_do_down(nic); +} + static void e100_tx_timeout(struct net_device *netdev) { struct nic *nic = netdev_priv(netdev); @@ -2261,7 +2270,7 @@ static void e100_tx_timeout_task(struct work_struct *work) DPRINTK(TX_ERR, DEBUG, "scb.status=0x%02X\n", ioread8(&nic->csr->scb.status)); - e100_down(netdev_priv(netdev)); + e100_do_down(netdev_priv(netdev)); e100_up(netdev_priv(netdev)); }