Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1681342rwb; Sun, 14 Aug 2022 09:24:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR6aQxdPJrRi0YxhcwR0+PWlQFQgkElvfVw0swb8ofjM566PS9UYw35yk7sONsZRvJ+1JmSG X-Received: by 2002:a17:902:ef46:b0:168:bac3:2fd4 with SMTP id e6-20020a170902ef4600b00168bac32fd4mr12855872plx.132.1660494245573; Sun, 14 Aug 2022 09:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660494245; cv=none; d=google.com; s=arc-20160816; b=ZhB5O05CjXO3wgG5kJzRHAGU2vZvnovT3MSsvUSc+H/EjsU5qBuIhtkwEH+V/9j6DH L2NGbOLerl4XYF6m5tTQSqAX849NbtSt4/JHoi2fqAXMuxgdwh7FP0ryL3ZA0f6fTxYH tCkcV9dq8O2O7sxY11fTjvlg9o6J27+46X9u4QJOrts6fSH7InsLy0JrWeNXXPRmWeRN Pl0KYN3/6G4RcJY/KVtRHWK2lJFKDyZXhR5Qin4mjcZ9vZDRY2Ws1c4QkWZT8nKeuj9R 9lmNP2utlL/7iY/7gDgFCA+7TCBqQm3yq5aM9hKNPjBuZsjhGnUyNesUOjfTWIKGXj6b rBoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SqCvrO1uYYWxtpEUTya+eRbD0nirKwX0JYrSsyn7sqg=; b=JmpBnm8fFdZPzcy/rNeBwuP2ugIS8zOMTcUTTRG8adl0TlRML2hvPN5gMvKxa3YDIt u5P59qMHsglYR0UVKwbxekBh6rRqwTOwAl7NjsISVtejvA6p/he0QmLbB4WvYRo6htaT LYU8lwOEu2ED3pZsmSLnUup5JJspuKQZ8A7yQM0JYZFz23NHxhIIUELawVVrhJpZLMT+ 5JjvNnMenx/8+MjMEXlEFLaigZe6Iuof9gxIra4/vwthyEsfWTwU7zHksNSK5X7XHC7x UlQJ9LwzlFpk2BJXEzPHZmV8dkfAB6NJxCJVW1xiGVArvOq7bKxNBe2r6EU7BEMpFeQf 5qCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UPK2418E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020a170903228400b0016f8fdcc3d3si8768362plh.84.2022.08.14.09.23.55; Sun, 14 Aug 2022 09:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UPK2418E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S240615AbiHNPcQ (ORCPT + 99 others); Sun, 14 Aug 2022 11:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231731AbiHNPbg (ORCPT ); Sun, 14 Aug 2022 11:31:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99FDF1ADBF; Sun, 14 Aug 2022 08:29:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9BA5DB80B7E; Sun, 14 Aug 2022 15:29:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97664C43142; Sun, 14 Aug 2022 15:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660490982; bh=Hz4IDQ1JODRnQj2XRHBXSjJFvRrsRauABgljRV7KOqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UPK2418E/KuMH2gtRrux649RXk29tzU8xUnfu9VmhH3sBzRLkJZ4xQgFNd74BnxUY GW1lZBusHuFItxhPoAiFweMIFVM8h9iOEN4PunOHyIDOkCJegjyhkqJAHAmQE/b4aS DEn+Ypfi5CsWREU4i6F6hNb9SeT4Zt8DKQXQ1m04431i3lPQ/j2k7obwi/mxr1Zi6M SZhJEqbjp360zAIh44BRx+47LRI5/Ck/c48Dz5hlLetzKSLklVmVCofRNFwj5Soq0J CLflJ6njQfVGYkVojOrGQIO1XI3W/0e7I5lds24+lzcPXsMD5yTEzngmkAHTl6ownN Fxxflznapekhw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ben Dooks , Vinod Koul , Sasha Levin , Eugeniy.Paltsev@synopsys.com, dmaengine@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 45/64] dmaengine: dw-axi-dmac: ignore interrupt if no descriptor Date: Sun, 14 Aug 2022 11:24:18 -0400 Message-Id: <20220814152437.2374207-45-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814152437.2374207-1-sashal@kernel.org> References: <20220814152437.2374207-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Dooks [ Upstream commit 820f5ce999d2f99961e88c16d65cd26764df0590 ] If the channel has no descriptor and the interrupt is raised then the kernel will OOPS. Check the result of vchan_next_desc() in the handler axi_chan_block_xfer_complete() to avoid the error happening. Signed-off-by: Ben Dooks Link: https://lore.kernel.org/r/20220708170153.269991-4-ben.dooks@sifive.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c index 41583f01a360..a183d93bd7e2 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -1054,6 +1054,11 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan) /* The completed descriptor currently is in the head of vc list */ vd = vchan_next_desc(&chan->vc); + if (!vd) { + dev_err(chan2dev(chan), "BUG: %s, IRQ with no descriptors\n", + axi_chan_name(chan)); + goto out; + } if (chan->cyclic) { desc = vd_to_axi_desc(vd); @@ -1083,6 +1088,7 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan) axi_chan_start_first_queued(chan); } +out: spin_unlock_irqrestore(&chan->vc.lock, flags); } -- 2.35.1