Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp883779yba; Thu, 18 Apr 2019 11:09:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqy76PAiFmKgGT8ZUQF50jFBVZoLRvTJvOYskgwKqLH/tZ/YyhSe0Yt5XHwB97ukwJSdXrPH X-Received: by 2002:a63:500f:: with SMTP id e15mr92348191pgb.198.1555610999649; Thu, 18 Apr 2019 11:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555610999; cv=none; d=google.com; s=arc-20160816; b=hnfXBjLrSzNVHgkH37GXWFx0mjv5aKl7QvfUu6trhESgCeyfE4k/YVAj6tJfOYB8r4 uueEWCP6gMRXpiMYZfA+vprmy4J7ubE080a7A4XCSUmnTALLxRpCHAUiqK+foIhvhgCa q9Q6mdNyUY5Qnnv+rFnUurAm26uBHJNd9wGRwYHbLgcbPJAj6gb5347BPRXTSLRllgj4 Nn4vr6WyTismSMDaiJZvbBh1i4t0ozrKRqUHjbAXzrh+q/j3XdR7Wd25cKoM4hBT6P17 1ZTpqSXUnZ03O/g2M9HnCVgYfLJOmyeD8OLl0Ws/ShcPshc8hqpp7Mwb+VGq5N8cCmH4 mohQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Eh/4NTj1OcqDIhq8aXkOuz4ULj9hRqrufTZSxle//9M=; b=w6pDvlpz85Tu4D6t6eUerwqBRw1Z/amzxjJXRdEoelz1N6ZksyCDLHMG5LAsmFmYGH xyCp0crE1lwgSjCaS0XBfSfe+e3wBagnbQnYmzxtwrfQes2EFHARTCfmzlRijSDCrYr4 89PJJNQifpkZzmgzAUkc6o0y92PtZrKWcK8oCBI9QFRVoYQZZD+lWSvAwP6WiBPLfrfa rZZUhmk1ap2XDzEgKoJQAn7WswZmfEZ67+r7netSfNsD29b8ALyTK0NEQhbYX7l6yAEZ 4KB0gVnqDE/S0PBuvWeJRzbwaMZRrk3j38ZHJtZqIzD4gQ2SwdracSZin1KJXbsa2Ds+ XBrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bxNts09l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13si3160185pfb.67.2019.04.18.11.09.44; Thu, 18 Apr 2019 11:09:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bxNts09l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391717AbfDRSID (ORCPT + 99 others); Thu, 18 Apr 2019 14:08:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:39046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389981AbfDRSIC (ORCPT ); Thu, 18 Apr 2019 14:08:02 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BF51B217FA; Thu, 18 Apr 2019 18:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610881; bh=j58yixsDI6ZuiKiOz58zEgSjU2aeoQzcyZ4UP7Ai3fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bxNts09lLUrGOvGdpIlGchhSlpvCvfJ/0vgk7oJV1NWUf+63D6Sck+iiakPIOU84z ssfIUvqo2DaEjYoyyOxhL+VKWDxMVogGDuGVHtKwe1hs9W/3Jkm7qCHpM+XHLKyqss Pv461pPkL6CgZOs70rR3aBYL41J/5XCt71egPTzk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Morgenstein , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.9 07/50] IB/mlx4: Fix race condition between catas error reset and aliasguid flows Date: Thu, 18 Apr 2019 19:57:18 +0200 Message-Id: <20190418160423.786114890@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 587443e7773e150ae29e643ee8f41a1eed226565 ] Code review revealed a race condition which could allow the catas error flow to interrupt the alias guid query post mechanism at random points. Thiis is fixed by doing cancel_delayed_work_sync() instead of cancel_delayed_work() during the alias guid mechanism destroy flow. Fixes: a0c64a17aba8 ("mlx4: Add alias_guid mechanism") Signed-off-by: Jack Morgenstein Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx4/alias_GUID.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx4/alias_GUID.c b/drivers/infiniband/hw/mlx4/alias_GUID.c index 5e9939045852..ec138845a474 100644 --- a/drivers/infiniband/hw/mlx4/alias_GUID.c +++ b/drivers/infiniband/hw/mlx4/alias_GUID.c @@ -805,8 +805,8 @@ void mlx4_ib_destroy_alias_guid_service(struct mlx4_ib_dev *dev) unsigned long flags; for (i = 0 ; i < dev->num_ports; i++) { - cancel_delayed_work(&dev->sriov.alias_guid.ports_guid[i].alias_guid_work); det = &sriov->alias_guid.ports_guid[i]; + cancel_delayed_work_sync(&det->alias_guid_work); spin_lock_irqsave(&sriov->alias_guid.ag_work_lock, flags); while (!list_empty(&det->cb_list)) { cb_ctx = list_entry(det->cb_list.next, -- 2.19.1