Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3322570rwa; Tue, 23 Aug 2022 02:49:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR4O3pCosGpK/rv340WILgn2HzCkb0IoXvywc2wryYyba/9J/iZd/cY+QI77z2TVw7dfp/nO X-Received: by 2002:a17:906:9b83:b0:730:b3ae:343 with SMTP id dd3-20020a1709069b8300b00730b3ae0343mr16328320ejc.670.1661248166142; Tue, 23 Aug 2022 02:49:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661248166; cv=none; d=google.com; s=arc-20160816; b=it+QMmKI28TEI1Eoj6ZtddjRAgEp00pqo4/lsEbo1DqMxMey3PgAVW4A8HwESHswpE gHfHoBQw9dslnv31os8vYki3DvcEmfvC2e2jf0lvBtel25ESiO2VYH4qIh8RaJvfwELn nLJ/59Fyb5KzvnMM//WhrkJjyWwChYE2De1sKnAD2laq3ZXhCZLpPEmjY19pTffSp11Q qUR+0f8vEd6pdJF5iZfUwAU3ej5OWlCOyLJHIPPzJKXGpRwwqNy0+e8gwjve9D/s3TEI pdLKy6DjVn3ZiX56QG0/22LiG7GtGTaeoHr7kRoxl9Mp0oDTJzL7zXdasiyZAVRXpW3c SOUA== 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=SqCvrO1uYYWxtpEUTya+eRbD0nirKwX0JYrSsyn7sqg=; b=PYx9s0g4WluiWC48BOoGhNxHqhtJZEwfEnMatATs8OeoJR630iJwNPw8tuPMrID8b5 VyY3Ho5E0298eHqatZX4a5INoX8ScCrYtO+yBmv80M6mS1NRNN9EUtrJMT2VohwBVPb0 Ba9RYFAq4/iQS2xKGrO/477mS6LQV14bDpV4RWQ8HHkCFKI95JK/EhjCRUdZZm72eesO xRywtqBjPuYce+ZLGjWkoWJL7CGDxpwu7wvYzBl9O3qEDsIOszXT8z5QY2TEiW11AgtU UmGtI6XAOeNR+lYLVzGs2kzSJ0mvvg1ypprgz9qlBnELiFPEcyNMBhHIbB4DhhsmjYkX PZ2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t9HnqP0H; 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 hb7-20020a170907160700b00731010c202dsi10956217ejc.764.2022.08.23.02.48.59; Tue, 23 Aug 2022 02:49:26 -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=t9HnqP0H; 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 S1349196AbiHWJXr (ORCPT + 99 others); Tue, 23 Aug 2022 05:23:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349727AbiHWJU6 (ORCPT ); Tue, 23 Aug 2022 05:20:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D1D8A1E9; Tue, 23 Aug 2022 01:34:10 -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 D721DB81BF8; Tue, 23 Aug 2022 08:33:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 442FFC433D6; Tue, 23 Aug 2022 08:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243598; bh=Hz4IDQ1JODRnQj2XRHBXSjJFvRrsRauABgljRV7KOqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t9HnqP0Hh5QUSJWsKFjVhqkgVZe95VhiBMzixt0Q6vYTsyogARRs+ffphbsa+lk3B ktkzaZpscqlRCF87H7EJ79OpjlbOPd7LlYqr8TMoHa5uOo6B+ZvF5JLdgwoMqrHYwT u2MZYBmtuB/dxKlUpbmB/NHiHL51EHv0GJElzZak= 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.19 300/365] dmaengine: dw-axi-dmac: ignore interrupt if no descriptor Date: Tue, 23 Aug 2022 10:03:21 +0200 Message-Id: <20220823080130.725787493@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@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 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