Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3413723rwa; Tue, 23 Aug 2022 04:29:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR5+TjQJgQU/0aBtnv42Yjg+/oMEQUQSz97KkYqCA2t0kql578ZwmFuz3lSGR0yKbRCCpfet X-Received: by 2002:a17:902:710e:b0:172:7ad4:39b3 with SMTP id a14-20020a170902710e00b001727ad439b3mr24410980pll.78.1661254197976; Tue, 23 Aug 2022 04:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254197; cv=none; d=google.com; s=arc-20160816; b=mYG7qdS/XNUSk7pBS4Ytmk2gXjFoZW380oUvnPT6RuP1Q1A0wENwnFl1t6U4VdA7Bb aqBcKIR7qsgjMS8hMTzlCDOeqDaN4qvpoOcm7mSvjx2KPO3Xa/mQ2sBCN4bKulEVLNMk fNWsxvm3rWoK2GyUiiD3gz49vTSpdy/sNXwTLabvjzr+ypftfh5gxT2YwON+PnfYvsWl JNY3JoPfuT4GBFhY8mjM/viag4u169y/M85vxog7JZKlBAk+e+6LTVEFX4kVYrIonLvm +xYJ5OFbYFljlcKQFKAzoy5e4VwdhlGDFl09FkfVgu5Ir0ywo8wW9GvFrvSU241dTMgh PVfQ== 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=7egff1ZaVwag4q3VoDnaJB+D9V5wOQC06KwbzUX8Nj4=; b=Is+xqw/IdGhocRF1rQjBCgP6U/fEolq2kQntg+NvmoFbtM9cFrJaMdQxNq85T8uJxG aAcEWpW/CkSie/tXoIqx1S15JlW5EbuRy5yqK1pgHJ5NhQtBlOo08CLKzlHQNubKuTQY lPfBrHR/b18A+kpThnn1/4TtreeiIM7DQqHuFHbwzFSswz+Maglq+56uj6ITgXOj4Pkm p0e5ZGwJFQzU/DnA7Urh25odF7WbFQkYUPGCcnUy9/S6ZRUEGNh87jUoV/Uq2KCMaHi5 3Pob4xa92xoEQcB3MLV55UMtzfjbAoJgV97+yecIrinPgTkKA2Zic9ojjuoiPzFtnTPf TK5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dP9EnbgQ; 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 m6-20020a654386000000b0042971e401e3si16178042pgp.307.2022.08.23.04.29.46; Tue, 23 Aug 2022 04:29:57 -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=dP9EnbgQ; 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 S1356482AbiHWLDU (ORCPT + 99 others); Tue, 23 Aug 2022 07:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356773AbiHWK7A (ORCPT ); Tue, 23 Aug 2022 06:59:00 -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 E6823ADCFE; Tue, 23 Aug 2022 02:13:58 -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 B2AE660F54; Tue, 23 Aug 2022 09:13:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB036C433D6; Tue, 23 Aug 2022 09:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246029; bh=zCjPwheLub6dsDGmASzjdfqqFdiCv1VVXqIVLu32/tE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dP9EnbgQMl1cZOQEiIgZCqEmzH3P9etlcG7qAemoNBlnT7lx1aQemYEQy1ZCaJ/p5 zpjPW9HV53J3Dh+gymd3L3cdFB4SX3xAo3QqIgWEv054hQo4BTMGHeQTuDYC2vNId8 EgU4PxNHXFnKpmH8s2CFtIorTv6STINB+m+Kx0W4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Baolin Wang , Vinod Koul , Sasha Levin Subject: [PATCH 4.19 266/287] dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed Date: Tue, 23 Aug 2022 10:27:15 +0200 Message-Id: <20220823080110.305326297@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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: Uwe Kleine-König [ Upstream commit 1e42f82cbec7b2cc4873751e7791e6611901c5fc ] It's not allowed to quit remove early without cleaning up completely. Otherwise this results in resource leaks that probably yield graver problems later. Here for example some tasklets might survive the lifetime of the sprd-dma device and access sdev which is freed after .remove() returns. As none of the device freeing requires an active device, just ignore the return value of pm_runtime_get_sync(). Signed-off-by: Uwe Kleine-König Reviewed-by: Baolin Wang Link: https://lore.kernel.org/r/20220721204054.323602-1-u.kleine-koenig@pengutronix.de Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/sprd-dma.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 0fadf6a08494..4ec9a924a338 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -987,11 +987,8 @@ static int sprd_dma_remove(struct platform_device *pdev) { struct sprd_dma_dev *sdev = platform_get_drvdata(pdev); struct sprd_dma_chn *c, *cn; - int ret; - ret = pm_runtime_get_sync(&pdev->dev); - if (ret < 0) - return ret; + pm_runtime_get_sync(&pdev->dev); /* explicitly free the irq */ if (sdev->irq > 0) -- 2.35.1