From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FB89C25B06 for ; Sun, 14 Aug 2022 15:45:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241438AbiHNPpW (ORCPT ); Sun, 14 Aug 2022 11:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241078AbiHNPoc (ORCPT ); Sun, 14 Aug 2022 11:44:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 635E1240B6; Sun, 14 Aug 2022 08:34:02 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 739A260CF5; Sun, 14 Aug 2022 15:34:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E859C433D6; Sun, 14 Aug 2022 15:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660491240; bh=L2kbwHsu7mISqjTwShhCSkl2t+nfdjFXCjhkhiPZprA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9lEuKYCbf+of5vMT+ZuxpGmGLGep4k9W1QobEV2fNRiPQD2FiYumxbAQTeMJhTZS k8LsLifcErNDIojWY91rEU9wjmajgHCHRe27GRqUXOpJcHSzX2hxJBm85qi12RXAm6 0Hob1VZkqPqZMgS9fCTNINJ90ZYEVcViNTuRosz4BqPZ48caU5f6UnF+CcpgHYkuup KCMEmkddqOyOyf424cQ3xX/NlKbH7G1JUmoSLQO5XF1hNUwx1pB/zhZkWRZvVEh2mV htc2E16zspnjGOSEFygobeyfJqV1dBPFYTcJGCJfMlI09gWPpH8glJ9bseRT/+b3gl 5w6rL8H0ARwew== 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.15 33/46] dmaengine: dw-axi-dmac: ignore interrupt if no descriptor Date: Sun, 14 Aug 2022 11:32:34 -0400 Message-Id: <20220814153247.2378312-33-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814153247.2378312-1-sashal@kernel.org> References: <20220814153247.2378312-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@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 8f765e2d7c72..48de8d2b32f2 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -1016,6 +1016,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); @@ -1045,6 +1050,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