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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA282C433EF for ; Thu, 7 Apr 2022 01:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=94SHiy4VVO2Q1256jdd9ytxy2BMDJeNPyGOr6bfzPtE=; b=Y72AaHVbAYd3fR Br3Rvsm0bNre5yrQNp6X6jtViFMtpQqgpnJHJ6pwhyIPkQfdrjkjQKDRNUJiI4wygsgHSQfcuav6V T/NJPErtmVHN6Q1UHnTslx7MVFLjsNrpQFxb0DwcPs9fawuln53+W8WaK+yprA0F2rr7Y3kecLQUP YMJLRKZtNGrEcyBvaI9iMQJoEcia4VV0QGaAahj15hm65b8uDCixcQKxpWPbBOPWEx9MmAZ1oabzo RJ+jbLcbvDcdZ6+NXmU3ak5KpN+sruMacLBPwE41rj5WK7Vej7Khb60CYFmQvvqDfQ3ZK6y4cORAh 2riudSeWmDNY4lmL+kGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncGgA-008UBJ-AP; Thu, 07 Apr 2022 01:11:18 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncGfr-008U3D-Ae for linux-arm-kernel@lists.infradead.org; Thu, 07 Apr 2022 01:11:00 +0000 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 E793061DB3; Thu, 7 Apr 2022 01:10:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 154C0C385A1; Thu, 7 Apr 2022 01:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649293858; bh=kyCpt+kxit9oAreUT89imPW8qUa5FVx/lcfqw+8Zcqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ftl+LK3bx35nhrTbbgfrpzI3/wwQm+PJmaBbev//7V5fIhlm8iGQfv54NKVM5O9CQ ZGGjw/aqljn0Gt6qSvjF8BQKrkkV3xVGMGCDn7BKx0f0RK56GNSm1F/yqVE5VNrWfA Cny6GslPo6CQCXC5KrTINkdqMCFeWDpNbkO9RyKeX1mpRDJ7TqOjxNq+bnwVhU7820 8ucRhfHP845WEkoUOjZ3PAVj3WNMcVkYNBxUuMNjvPML0vWZxBQjMZ7JRv8EvWPGVu LJA6M9LhEANQmYXTBG/y9T5IUHLRhl8NY7U6FP8GCuBcf4ui3I+Zspj9njf+v+oCAW vtjAkV7yIIRfg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zheng Yongjun , Herbert Xu , Sasha Levin , davem@davemloft.net, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, nicolas.toromanoff@foss.st.com, marex@denx.de, linux-crypto@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.17 14/31] crypto: stm32 - fix reference leak in stm32_crc_remove Date: Wed, 6 Apr 2022 21:10:12 -0400 Message-Id: <20220407011029.113321-14-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407011029.113321-1-sashal@kernel.org> References: <20220407011029.113321-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220406_181059_481159_B79962D8 X-CRM114-Status: GOOD ( 13.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Zheng Yongjun [ Upstream commit e9a36feecee0ee5845f2e0656f50f9942dd0bed3 ] pm_runtime_get_sync() will increment pm usage counter even it failed. Forgetting to call pm_runtime_put_noidle will result in reference leak in stm32_crc_remove, so we should fix it. Signed-off-by: Zheng Yongjun Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/stm32/stm32-crc32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/stm32/stm32-crc32.c b/drivers/crypto/stm32/stm32-crc32.c index be1bf39a317d..90a920e7f664 100644 --- a/drivers/crypto/stm32/stm32-crc32.c +++ b/drivers/crypto/stm32/stm32-crc32.c @@ -384,8 +384,10 @@ static int stm32_crc_remove(struct platform_device *pdev) struct stm32_crc *crc = platform_get_drvdata(pdev); int ret = pm_runtime_get_sync(crc->dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(crc->dev); return ret; + } spin_lock(&crc_list.lock); list_del(&crc->list); -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel