Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp789439ybj; Thu, 7 May 2020 07:41:54 -0700 (PDT) X-Google-Smtp-Source: APiQypKT4w1l3aIJHQMNTx3M1hRgf/Gj55NHX0A7WYD29rtCbA35NuIkJshSvLeUFKLCgk2raurC X-Received: by 2002:a17:906:c348:: with SMTP id ci8mr12709490ejb.73.1588862514126; Thu, 07 May 2020 07:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588862514; cv=none; d=google.com; s=arc-20160816; b=PJxMkxSfAq4nUWjYqLEcnIdwAye3gI5WK7aLpfhpEXdrETRay4x14voKzNkWtUmUyn QOlaIuTi4M3vBF36l3EdjJ1kyIvePG+VEy4t+VEPVgqYChlEvc5gYGB/bZrQksnKpe9b HoORqFac/mF+LqG4Wtdm5KASrEhkVMRBWqnhxBGiDUhewCSOdGPvuBWxk52SI14EShLc 7iBT7ElhX/CZFbxIuBs8PET2Ee2FStSlmqyCOVUTWgCOpEi5hk4wUNhXqa0lA1EsbO+S AAAVLzxLyW52W21ML6eixV0HAi+hdN0TrgYOmw6sX7VQzo/k3ZP0Ys1VXVWd88QhznlP ut+w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DGSEHVZRPjhwcCJeYlczo4b5KBzJ9w8cMXcapgrT3Fo=; b=0m7jGpM+05y6aKCYizS8wDjqunQ4dOXMz8hw73YgfG281W0EI5sWslV6hPT23nElRl rQaF/aRGrvfjhDF7Yo+G5k1v2ZrnpVb6lEMteytHaZlt176OrNY4yl+0RWH6mRIy0zpF blQmV3/CJ3z05jRWIZ3FdA8TNoF1MQaWZHy/wymU7sswwh8HFiFhdDJ1yy+jh9PiUc+o bbiO1gQ2eyS2clsc+DOzl0O/p6lJmxbblxcX/sF2e24+phUybaScfdy6FebX0ho53Y7i Ov1QpO4yzxXXn5AsOv7cAQrE/usy8Mj0dzgNAMsEeOUC3FRBSp7drz6kdXefQ5mpyTuz 4ZjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Mtys2fGI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a63si3489114ede.399.2020.05.07.07.41.31; Thu, 07 May 2020 07:41:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Mtys2fGI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728227AbgEGOiJ (ORCPT + 99 others); Thu, 7 May 2020 10:38:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:53666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727122AbgEGO1r (ORCPT ); Thu, 7 May 2020 10:27:47 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6B20520857; Thu, 7 May 2020 14:27:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588861667; bh=1nnHsVdBrNbkfWBXxTVXXxkC6uk3Re/8JIIgBHmsfGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mtys2fGIWBhcPHHUFTC2newjJ2J0Fy5FeV9gkE4OqGt0B83ggnKe5RX78j+tIvLx9 Z6PXFQt5gf8WvYUdbQXkSLTSKLkFX6G1C6P/z2kbdHXRVvQkLC4HaypGt+vka2B0Mq UtjREbSBLCfeCHtgooq6Ok9I/teb/woM41PNkR7s= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Madhuparna Bhowmik , Vinod Koul , Sasha Levin , dmaengine@vger.kernel.org Subject: [PATCH AUTOSEL 5.6 16/50] dmaengine: pch_dma.c: Avoid data race between probe and irq handler Date: Thu, 7 May 2020 10:26:52 -0400 Message-Id: <20200507142726.25751-16-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200507142726.25751-1-sashal@kernel.org> References: <20200507142726.25751-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Madhuparna Bhowmik [ Upstream commit 2e45676a4d33af47259fa186ea039122ce263ba9 ] pd->dma.dev is read in irq handler pd_irq(). However, it is set to pdev->dev after request_irq(). Therefore, set pd->dma.dev to pdev->dev before request_irq() to avoid data race between pch_dma_probe() and pd_irq(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Madhuparna Bhowmik Link: https://lore.kernel.org/r/20200416062335.29223-1-madhuparnabhowmik10@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/pch_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index 581e7a290d98e..a3b0b4c56a190 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c @@ -865,6 +865,7 @@ static int pch_dma_probe(struct pci_dev *pdev, } pci_set_master(pdev); + pd->dma.dev = &pdev->dev; err = request_irq(pdev->irq, pd_irq, IRQF_SHARED, DRV_NAME, pd); if (err) { @@ -880,7 +881,6 @@ static int pch_dma_probe(struct pci_dev *pdev, goto err_free_irq; } - pd->dma.dev = &pdev->dev; INIT_LIST_HEAD(&pd->dma.channels); -- 2.20.1