From patchwork Thu Nov 6 10:51:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 5240891 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A56E29F4D4 for ; Thu, 6 Nov 2014 10:51:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4B6C200DC for ; Thu, 6 Nov 2014 10:51:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E24332010C for ; Thu, 6 Nov 2014 10:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751882AbaKFKvf (ORCPT ); Thu, 6 Nov 2014 05:51:35 -0500 Received: from mail-wi0-f180.google.com ([209.85.212.180]:41958 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751229AbaKFKvd (ORCPT ); Thu, 6 Nov 2014 05:51:33 -0500 Received: by mail-wi0-f180.google.com with SMTP id hi2so1055101wib.13 for ; Thu, 06 Nov 2014 02:51:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iW/vZuyy7+HRSR8p4+DJgkIDG68HbC/f2BWDOZTQ4OM=; b=TjfP7m6MeqrORP5/8QEJSTQ4KLDNDLQYyvDRt+IEhsa7BR4C2EPtHbzozo/uoYe4LN 7zhmQNUiFTWgHCQR+m3zG5RNayiwTmjdqicqnwsNCRKIRhrcRq4wc/XbxBTWxSCLTkDo SN8vnsJmPtxAWdXTOIdP0Vz6zj+ONif/zZkqpDYheU3UW7d/UMbbpAQn/xwc0aUXRdC8 072lacwxUQcTIQCGvBrfoSOmxW/iNFCLPlsE7CEkoTOXjWsYDryQn3Q0WwbGMCvmvbVs c6VTDgbMzmVg8USanhFoETPtZ9SEGAHU3nLUDP7sTD1JjSbADTJJSEAIHUDTFDsllFQu tkyw== X-Gm-Message-State: ALoCoQkBjI2fpTmaB2rTvubVYiXcBkt2n1kE5i7guoV9Lf4bIr5e2W9rYaNaq4z5Y/lQdXhuPQ3v X-Received: by 10.180.36.205 with SMTP id s13mr38719198wij.11.1415271092276; Thu, 06 Nov 2014 02:51:32 -0800 (PST) Received: from localhost (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPSA id fq1sm19024616wib.12.2014.11.06.02.51.31 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 06 Nov 2014 02:51:31 -0800 (PST) From: Eli Cohen X-Google-Original-From: Eli Cohen To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, ogerlitz@mellanox.com, Eli Cohen Subject: [PATCH net 1/2] net/mlx5_core: Fix race in create EQ Date: Thu, 6 Nov 2014 12:51:21 +0200 Message-Id: <1415271082-7644-2-git-send-email-eli@mellanox.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1415271082-7644-1-git-send-email-eli@mellanox.com> References: <1415271082-7644-1-git-send-email-eli@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP After the EQ is created, it can possibly generate interrupts and the interrupt handler is referencing eq->dev. It is therefore required to set eq->dev before calling request_irq() so if an event is generated before request_irq() returns, we will have a valid eq->dev field. Signed-off-by: Eli Cohen --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index a278238a2db6..ad2c96a02a53 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c @@ -374,15 +374,14 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, snprintf(eq->name, MLX5_MAX_EQ_NAME, "%s@pci:%s", name, pci_name(dev->pdev)); eq->eqn = out.eq_number; + eq->irqn = vecidx; + eq->dev = dev; + eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; err = request_irq(table->msix_arr[vecidx].vector, mlx5_msix_handler, 0, eq->name, eq); if (err) goto err_eq; - eq->irqn = vecidx; - eq->dev = dev; - eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; - err = mlx5_debug_eq_add(dev, eq); if (err) goto err_irq;