Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2476346pxj; Mon, 10 May 2021 04:02:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpR6LtiN5b6LIp2/W422wel2+f+Pm+l83tIPt4adDV12po6l4klW3MDHEQ9IAunMcRodVN X-Received: by 2002:a17:907:766d:: with SMTP id kk13mr25237219ejc.417.1620644567094; Mon, 10 May 2021 04:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644567; cv=none; d=google.com; s=arc-20160816; b=qxPml73nlFLCmhnCpmyleBdzNIbHuzYTgFcCHQEHdrcaEMBMkEVJ5K3IMSxMtYndOx k/IrqO7MeT9OoFCX1sMfm9eSs6MhU3F9gl6vXfs2JTyKxz4zyu6r4kUdPYKKkG2nwH/M wCVxHOR1ho6o6AzyA2EpiyBmE1a3eu8WbZzPl0gQ68ZeBEBMqbywoGjPXF35awdPhMWo XoRC6E1YGgQw6x2KQGBRTrDNi7PWjWUu2XcjIJW9tFCnPmpNMpAtZhE0hWwB3+C3t8Jl vhvo2Grlmy3rA+BTg2g/B/JG/CDPllTysv/MW4GZi6Kh041dUzF2Z3amAUFm25H+YUnm W/Ww== 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=NvxrNyfpjBHvvP5OFQOD/9u2yVYDKbB0+pWn7hXRwn0=; b=eBCJRGZ3BUq5Wyff+8RWv0OJd268d+AqHaq6zEKBBCyLWyz7/3YeeRZlHoYjFKndcH tQDWF3joFbzJ7/B+3vCzPRXTXSMjI40JND3siV9+TMKEE6EfmZxxGz6YL+eLnJFA6EyO qXE5QI7xzIdQGKiD28ZBwOMaT2SMx0ijb9grv+RzywS0nJBCvIFTvR6RRl4VKcuh23oX 44Uvx69Yf7rKjRtY+utmQ+xw8XR8FedcewCRbz1NGgZ3N7NeE+dfs6aIps5Xou4rkch0 4h+C56Vvo+wrz5lcdq096WGYuFipf/f9O1mU4rAPu4jJ7DAWgv0bXO2RVpowoOoGJkgO S54g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FcBS6jy2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw16si13606060ejb.337.2021.05.10.04.02.23; Mon, 10 May 2021 04:02:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FcBS6jy2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S235489AbhEJLBH (ORCPT + 99 others); Mon, 10 May 2021 07:01:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:57348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233227AbhEJKpX (ORCPT ); Mon, 10 May 2021 06:45:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B19A16199C; Mon, 10 May 2021 10:35:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642925; bh=Y4ruUgLEFtdjN/MsVT/UtKbMP86g7mEtzbd5RxTHF94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FcBS6jy2R+Le7FN/Y7cOHaWDdsuk2DfvNob2YnJkraGK1kNUmCyJYlSFrJ8kGTJi9 X/guMvXKNl8ZKVLUEMY87i9g387ZXOigZsX5wBHgWuovdD+N0oJCZT4fwX8BzdTb4x IgbtL74cGotdIeR9QsLQOUO70QasCSpwV1arVFnk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shixin Liu , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 107/299] crypto: omap-aes - Fix PM reference leak on omap-aes.c Date: Mon, 10 May 2021 12:18:24 +0200 Message-Id: <20210510102008.478130426@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shixin Liu [ Upstream commit 1f34cc4a8da34fbb250efb928f9b8c6fe7ee0642 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Signed-off-by: Shixin Liu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/omap-aes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index 1b1e0ab0a831..0dd4c6b157de 100644 --- a/drivers/crypto/omap-aes.c +++ b/drivers/crypto/omap-aes.c @@ -103,7 +103,7 @@ static int omap_aes_hw_init(struct omap_aes_dev *dd) dd->err = 0; } - err = pm_runtime_get_sync(dd->dev); + err = pm_runtime_resume_and_get(dd->dev); if (err < 0) { dev_err(dd->dev, "failed to get sync: %d\n", err); return err; @@ -1133,7 +1133,7 @@ static int omap_aes_probe(struct platform_device *pdev) pm_runtime_set_autosuspend_delay(dev, DEFAULT_AUTOSUSPEND_DELAY); pm_runtime_enable(dev); - err = pm_runtime_get_sync(dev); + err = pm_runtime_resume_and_get(dev); if (err < 0) { dev_err(dev, "%s: failed to get_sync(%d)\n", __func__, err); @@ -1302,7 +1302,7 @@ static int omap_aes_suspend(struct device *dev) static int omap_aes_resume(struct device *dev) { - pm_runtime_get_sync(dev); + pm_runtime_resume_and_get(dev); return 0; } #endif -- 2.30.2