From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 223A8FBEF; Tue, 25 Jun 2024 09:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719308162; cv=none; b=SrhyDpbJkio/4T8XMfSmTdp9K4hM+Frr4cZcmo9ao2YQtAg23Z+rHeH+4XHbHCtG7EJuFhYBYj5aO+y0E5AbRNjsRKbICyULXFk2sG63RNAStVVhlCmOX96zvnut42bLb8bgeW9/LwS4jyFQxmk7N4Wj8C2hpw2zQMN9NyHmbno= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719308162; c=relaxed/simple; bh=h8NrlcKZGp5ZqBQtPyuT12llTUE4o2BPgnKH0mDsXyY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FjkD/xo0AyoMrIdpHHUh3NFp8yBPwi8XqJONCum0uzx6RQfHW+Jc9/Ljd4efYxsPAqrZK4gXE9bE2PqItm2NUsELFxsiV51igS8xSJMIppI5czqG1W6QsknLy1RSuDFd1uVnN85XywpqwXnrC7cYXv3KqmMLXtynK0db4JbnGXE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=j3R0/3kZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="j3R0/3kZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 965F6C4AF09; Tue, 25 Jun 2024 09:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1719308162; bh=h8NrlcKZGp5ZqBQtPyuT12llTUE4o2BPgnKH0mDsXyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j3R0/3kZux8YHu1yY/HeonmeE3H+bNYgiWrWfFBehFA2WD36/EU6+qanWc/undzWX t8vetxO/X8hLUgQTt0pFVGiZynhFdcDkI3Dv72t/Txw4grF1gaezVbRVxpMWWjUoed 4tb3cyQAs7qHADsQMGFh59Jd6pgLi1U+q2gxyU+w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chenghai Huang , Herbert Xu , Sasha Levin Subject: [PATCH 6.9 003/250] crypto: hisilicon/sec - Fix memory leak for sec resource release Date: Tue, 25 Jun 2024 11:29:21 +0200 Message-ID: <20240625085548.169933515@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240625085548.033507125@linuxfoundation.org> References: <20240625085548.033507125@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chenghai Huang [ Upstream commit bba4250757b4ae1680fea435a358d8093f254094 ] The AIV is one of the SEC resources. When releasing resources, it need to release the AIV resources at the same time. Otherwise, memory leakage occurs. The aiv resource release is added to the sec resource release function. Signed-off-by: Chenghai Huang Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/hisilicon/sec2/sec_crypto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c index 93a972fcbf638..0558f98e221f6 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c @@ -481,8 +481,10 @@ static void sec_alg_resource_free(struct sec_ctx *ctx, if (ctx->pbuf_supported) sec_free_pbuf_resource(dev, qp_ctx->res); - if (ctx->alg_type == SEC_AEAD) + if (ctx->alg_type == SEC_AEAD) { sec_free_mac_resource(dev, qp_ctx->res); + sec_free_aiv_resource(dev, qp_ctx->res); + } } static int sec_alloc_qp_ctx_resource(struct sec_ctx *ctx, struct sec_qp_ctx *qp_ctx) -- 2.43.0