From nobody Thu May 7 17:45:30 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D366C433F5 for ; Sun, 22 May 2022 13:07:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345590AbiEVNHb (ORCPT ); Sun, 22 May 2022 09:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240818AbiEVNHY (ORCPT ); Sun, 22 May 2022 09:07:24 -0400 Received: from smtp.smtpout.orange.fr (smtp02.smtpout.orange.fr [80.12.242.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F7D137BC1 for ; Sun, 22 May 2022 06:07:20 -0700 (PDT) Received: from pop-os.home ([86.243.180.246]) by smtp.orange.fr with ESMTPA id slIdnekxaEMbDslIenUSQP; Sun, 22 May 2022 15:07:19 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 22 May 2022 15:07:19 +0200 X-ME-IP: 86.243.180.246 From: Christophe JAILLET To: dan.carpenter@oracle.com, Gonglei , "Michael S. Tsirkin" , Jason Wang , Herbert Xu , "David S. Miller" , zhenwei pi Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , virtualization@lists.linux-foundation.org, linux-crypto@vger.kernel.org Subject: [PATCH] virtio-crypto: Fix an error handling path in virtio_crypto_alg_skcipher_close_session() Date: Sun, 22 May 2022 15:07:10 +0200 Message-Id: <068d2824cf592748cbd9b75cf4cb6c29600e213c.1653224817.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now that a private buffer is allocated (see commit in the Fixes tag), it must be released in all error handling paths. Add the missing goto to avoid a leak in the error handling path. Fixes: 42e6ac99e417 ("virtio-crypto: use private buffer for control request= ") Signed-off-by: Christophe JAILLET Acked-by: Jason Wang Acked-by: zhenwei pi Reviewed-by: Gonglei --- drivers/crypto/virtio/virtio_crypto_skcipher_algs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c b/drivers/= crypto/virtio/virtio_crypto_skcipher_algs.c index e553ccadbcbc..e5876286828b 100644 --- a/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c +++ b/drivers/crypto/virtio/virtio_crypto_skcipher_algs.c @@ -239,7 +239,8 @@ static int virtio_crypto_alg_skcipher_close_session( pr_err("virtio_crypto: Close session failed status: %u, session_id: 0x%l= lx\n", ctrl_status->status, destroy_session->session_id); =20 - return -EINVAL; + err =3D -EINVAL; + goto out; } =20 err =3D 0; --=20 2.34.1