Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3410191rwa; Tue, 23 Aug 2022 04:26:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR4D87MkSVcnCCOzXEfNtzCJ0pxRud8NU7sm40VwjxolmiSSxmy4ltvPUE1pPhB7RLiGmWyq X-Received: by 2002:a17:907:75e1:b0:73c:2333:7135 with SMTP id jz1-20020a17090775e100b0073c23337135mr14578021ejc.495.1661253965586; Tue, 23 Aug 2022 04:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253965; cv=none; d=google.com; s=arc-20160816; b=lV/aqgmrY23sylQ62wkk6LtjWq7avM9TSUPvc+AUDRrHycXtaGNPfq4eGuCuEpSo7M I2xqf8LSJd97G11CTM38FgGJt7aVpxSNfvrD2nht9du1WM0vhF+JaESaxeP36/x9s7Ew kJjoyskVgcOO/LsmNXb4IKwgPt/z9LPr1glHCBSh18Eyu4r+GJ5q6n8/5O6U92VJwXaH 52ZVjmBlJoCRAx8S34ETbed5LJDPiilfR95Ro6GEM2Ib2CKNQ7n4grUkV/nLK4Isjkdw 7BiBWKQFJGkb7jlaeiojQHnKJbZoaIQLoKFBRvSUmAB5Q/XbbymsuS68v8itce1NPsHf S66Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RruxDx1RpoC3kZiUt8Q3RLuMtbnvmFXPetiDbkD5xNY=; b=q0XzPiOwqhX58b1M4PY0ZkmZgy9MxAIJ3UIYGRDc/ZkIxEcvmE4hlwTz9bQEx23j7T G/7zc+C5hu4jVcWPjQOFYMlPyDc2Su3UiKc2ePuZ0ejTJGOo6LFWSPN+aSaDCf6vfE+v 2+KxJ0EvOM86vhy/BQnZdJfgAHIFiXusnXdkjHdn0kEme6AF3dvIYfb3MaA7DvtpgLyT 2Aquy/F+ysbekdCSXpKkoPbkJ2/Im4u/II0qTz6g8EJ3BcnMhiDo78FoBhN5eKMgBuvC o6D5/BZeuM8ZwxEtWtmoK8xWqWF2duohnd+BF5do5UQQ8UjTuX0wZMeiTe2EEXyTzKjW 7m4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="g/xvVOSj"; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb36-20020a170907962400b00730f07ead67si77274ejc.929.2022.08.23.04.25.39; Tue, 23 Aug 2022 04:26: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=@linuxfoundation.org header.s=korg header.b="g/xvVOSj"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348695AbiHWKYZ (ORCPT + 99 others); Tue, 23 Aug 2022 06:24:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353542AbiHWKLi (ORCPT ); Tue, 23 Aug 2022 06:11:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3403AC3C; Tue, 23 Aug 2022 01:57:16 -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 C78FF61524; Tue, 23 Aug 2022 08:57:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA856C433D7; Tue, 23 Aug 2022 08:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245035; bh=L2kbwHsu7mISqjTwShhCSkl2t+nfdjFXCjhkhiPZprA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g/xvVOSjOCbUBkOM11VdICgKkXOHBM22KKVfcSlvYnHXTiRJFpZKlIaec0ou9BV6g ks5Ple0hZ89ZgkCqXLiVoMopR8SPc0hSLafnrt+F8vyRhsNFTAdrNs8FuiWcvXi+5n 5LbQBPiWUXMm9WV3WYuM9KT5ngZJzy/aO+gGd6dY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Dooks , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 194/244] dmaengine: dw-axi-dmac: ignore interrupt if no descriptor Date: Tue, 23 Aug 2022 10:25:53 +0200 Message-Id: <20220823080105.889179972@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 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