Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1542761pxa; Thu, 20 Aug 2020 14:10:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrHyRzCUSvhFhlnKxS/LfhE15QtZveevn4EIcpLpOa/l7In0e6Eny8obnFR/mo9Z9SLt9G X-Received: by 2002:a50:fc0a:: with SMTP id i10mr479480edr.5.1597957802385; Thu, 20 Aug 2020 14:10:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597957802; cv=none; d=google.com; s=arc-20160816; b=MNOdlQQbqXKd8zejblXrTFPpD2jhR4938/yipLJPNU7qsWVJCfj8zoNx57ANZnP6ur IocN2j81O/XFSNwXWDRVnSzto4rcFrpbED6y8ls8k7AVLrTjEb7vDGUZ31CePXxBV24j woUkAD4PJo8dit82cXA9NLUq0kLI6vLWL6w3+galKn5okTSTLTnaVIS+2XHJAJ1ucsn4 HrmPfGdEC2YQd+PQldUP+wYHfANud5EXlHbbRpGf1MhHgzz/yzfR9L5bKf+e5J5AevEJ uFzBE8lntaWQSaSJnb9M8mw/JQYFq5pO0bRfyTLdU6aDWhie81KouytLtS3WfSTVb4oc 8ilw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Pba3wqITnv1HSpWANOUiwdXFXFAyf2fUBM6+eV5vKqA=; b=X6q6ks1AJAQobDYKZC2DEso9hMUb5368tP3O9forUK2rb61nYwWeQBPXF20P9J3+g5 DnMNm015GoAkCAao3RMbr593xt+4mbRN4VxdAdBIoSyMIif37kkNpm/GKghsK0K8th4f ON11RKVgk1Q/b0ccIlodHHLgspgQorZVgX6Sqab+KVmImTf9fxGZosNr8CyVfKgaU4yT fwtSvubt0IAKFur/gKnvYD4AVFsjoomSXZ3xpUsQjj1Xo3ku3aRD0ZWe9RgmTmNUHpow gydaaLSlsQTWvTDwliGuYcrsY3QGIbcp47TiS2RKiwGjtrQbH1tfmSAf7KTGDfGBaoTP U0GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@metafoo.de header.s=default2002 header.b=mccu0oQk; 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=fail (p=NONE sp=NONE dis=NONE) header.from=metafoo.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si2067651edl.77.2020.08.20.14.09.38; Thu, 20 Aug 2020 14:10:02 -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=fail header.i=@metafoo.de header.s=default2002 header.b=mccu0oQk; 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=fail (p=NONE sp=NONE dis=NONE) header.from=metafoo.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbgHTSXx (ORCPT + 99 others); Thu, 20 Aug 2020 14:23:53 -0400 Received: from www381.your-server.de ([78.46.137.84]:54198 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726949AbgHTSXu (ORCPT ); Thu, 20 Aug 2020 14:23:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=Pba3wqITnv1HSpWANOUiwdXFXFAyf2fUBM6+eV5vKqA=; b=mccu0oQkjLx5k/gEQ8IzLxYpyX h1dzqZiLk5lGWwrDefLML+xi1PbKVHeCS5wmwalrBkanPFJ7s1LLy2WCXjw0HGngC+k9wNOUTVUL7 hCRZ1nnCa5inJZ0drhD9yckBGW5WtMjfHzT6XyFp/xb4iYmrQlPqjuqdKZZi0jfk7EgyQOLFRvwoL 1H/Ll+strO7/vg3Shygo90l1iafT5nuCFZZeutaheRVbZjn+iAuB+/GI3iKCy/WbwUy3+nQ41gR/H DnLeKokhdtC+5e2nFtVBDJxz65+gTJdJaic0DqE3a4rAL1zNWjV4nHkKN/IHcShx7TFk+sJH9C47x ZbXCd42A==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1k8pDt-0005Xe-3p; Thu, 20 Aug 2020 20:23:37 +0200 Received: from [2001:a61:25dc:8101:9e5c:8eff:fe01:8578] by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k8pDs-000D44-US; Thu, 20 Aug 2020 20:23:36 +0200 Subject: Re: [PATCH] drivers/dma/dma-jz4780: Fix race condition between probe and irq handler To: Paul Cercueil , madhuparnabhowmik10@gmail.com Cc: dan.j.williams@intel.com, vkoul@kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, andrianov@ispras.ru, ldv-project@linuxtesting.org References: <20200816072253.13817-1-madhuparnabhowmik10@gmail.com> From: Lars-Peter Clausen Message-ID: Date: Thu, 20 Aug 2020 20:23:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.102.4/25905/Thu Aug 20 15:09:58 2020) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/20/20 1:59 PM, Paul Cercueil wrote: > Hi, > > Le dim. 16 août 2020 à 12:52, madhuparnabhowmik10@gmail.com a écrit : >> From: Madhuparna Bhowmik >> >> In probe IRQ is requested before zchan->id is initialized which can be >> read in the irq handler. Hence, shift request irq and enable clock after >> other initializations complete. Here, enable clock part is not part of >> the race, it is just shifted down after request_irq to keep the error >> path same as before. >> >> Found by Linux Driver Verification project (linuxtesting.org). >> >> Signed-off-by: Madhuparna Bhowmik > > I don't think there is a race at all, the interrupt handler won't be > called before the DMA is registered. > From a purely formal verification perspective there is a bug. The interrupt could fire if i.e. the hardware is buggy or something. In general it is a good idea to not request the IRQ until all the resources that are used in the interrupt handler are properly set up. Even if you know that in practice the interrupt will never fire this early.