From patchwork Sat Oct 22 07:26:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106320wrr; Sat, 22 Oct 2022 01:37:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qhU3NkJugo0LdjxUfaqqGOZz97j7oVaq/x/dQUxHeZQMv5Xr29O5vCdpivP5rDelDvmtG X-Received: by 2002:a17:902:eb89:b0:185:33d:cb34 with SMTP id q9-20020a170902eb8900b00185033dcb34mr23289229plg.55.1666427850043; Sat, 22 Oct 2022 01:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427850; cv=none; d=google.com; s=arc-20160816; b=TnLyoX+FLRzkkQkeaKa6kKe5Y8QQHPnSZq+9OtmRGPgvfrWY0muouP6JQc4SuZR8Dm +oijyAXSota2iB2HvfvM3ccY0Twb8voSc/sc567FZqP6KOnKOeTfEqXECKztdxAAGzIc 4OgXq67kCnuwqLYdrwZlHZosWHHLNEqeOadkXOs43tmaKO0gXeKNEKoVo7s6ECiF9TZm Yy/ZpaU6gpvXuAt/y/Xbmm7U2iudP+1KeSlP+GPKURgoqfSV44QB62mCaW7uwe5dnDln BDWhK3rjsN5jd6wroUtOxNbEq8OXTB4D6Bnl+0RhSuxxOsQqZUttOHUDACxO38n7oFOl Gk6w== 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=uZvUCTu4T2JTg8LdJK9vw+rzrfC2xSi8SJLrDaasu3A=; b=A27lM3Xr4jEsFpTssD86QrhfoVDB9D3+CuMSA1BHArQf/f51YeIaNiITW7dTeF2aTx 7jpHKqXbbOOimIoMPSOQZsckHpLIdCbJpZsS9VAx196cy5TKfQoaS+5/dzFQe73JiNjZ VhR+bEM1Mkltbe5lIP5f24IoGiLl2jZR61Eq9vFMeDXSF4BH9lvQAFPbT64amcQOdZn6 c3qsHipS2+QuMa7pqmdrHI88Rjt25ZUTIZ45IvQyWxCxK7fn9I3tdDOpPZZQ2F3eK5Bq NbDf/iHPli4WnBaTqrVo6ELFMPi0UpPIXD3k4RfjozKYfwnPikdiXlm23yvF61TZpQvU enWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DTDgSmyG; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i8-20020a17090332c800b0017f61b0bc5bsi30984597plr.557.2022.10.22.01.37.15; Sat, 22 Oct 2022 01:37:30 -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=DTDgSmyG; 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 S233783AbiJVIXQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233791AbiJVIVP (ORCPT ); Sat, 22 Oct 2022 04:21:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C49722E042B; Sat, 22 Oct 2022 00:58:55 -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 8BDAFB82DF2; Sat, 22 Oct 2022 07:58:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1976C433C1; Sat, 22 Oct 2022 07:57:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425479; bh=pgwEOrNfjoygXqCf/s4qyI7U4E29PrLsa3xhHvAaEdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTDgSmyGdZcz0Hz4NA904MrYm73HeE5Vfygeans9ATElps33WNIbSf8guTE+poGIW tKOK+YRdIMR0syCJSRuK6Pjh8OVyZMkYZ4DrW1EMUEIFM+rF4gkhi2AewQgw5G23cu +B7OAXagwWlQEfUONzUllumM+eGiqsHyAwD5Bryg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Weili Qian , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 514/717] crypto: hisilicon/qm - fix missing put dfx access Date: Sat, 22 Oct 2022 09:26:33 +0200 Message-Id: <20221022072521.012296213@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376248977948644?= X-GMAIL-MSGID: =?utf-8?q?1747376248977948644?= From: Weili Qian [ Upstream commit 5afc904f443de2afd31c4e0686ba178beede86fe ] In function qm_cmd_write(), if function returns from branch 'atomic_read(&qm->status.flags) == QM_STOP', the got dfx access is forgotten to put. Fixes: 607c191b371d ("crypto: hisilicon - support runtime PM for accelerator device") Signed-off-by: Weili Qian Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/hisilicon/qm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index b4ca2eb034d7..eb82e9864d14 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -2229,8 +2229,10 @@ static ssize_t qm_cmd_write(struct file *filp, const char __user *buffer, return ret; /* Judge if the instance is being reset. */ - if (unlikely(atomic_read(&qm->status.flags) == QM_STOP)) - return 0; + if (unlikely(atomic_read(&qm->status.flags) == QM_STOP)) { + ret = 0; + goto put_dfx_access; + } if (count > QM_DBG_WRITE_LEN) { ret = -ENOSPC;