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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DABF2C433FE for ; Mon, 23 May 2022 03:30:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355495AbiEWDaW convert rfc822-to-8bit (ORCPT ); Sun, 22 May 2022 23:30:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355479AbiEWDaR (ORCPT ); Sun, 22 May 2022 23:30:17 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAF0133A2B; Sun, 22 May 2022 20:30:15 -0700 (PDT) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4L62qK06nBzgY9k; Mon, 23 May 2022 11:28:44 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 23 May 2022 11:30:12 +0800 Received: from dggpemm500006.china.huawei.com ([7.185.36.236]) by dggpemm500006.china.huawei.com ([7.185.36.236]) with mapi id 15.01.2375.024; Mon, 23 May 2022 11:30:12 +0800 From: "Gonglei (Arei)" To: Christophe JAILLET , "dan.carpenter@oracle.com" , "Michael S. Tsirkin" , Jason Wang , Herbert Xu , "David S. Miller" , zhenwei pi CC: "linux-kernel@vger.kernel.org" , "kernel-janitors@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "linux-crypto@vger.kernel.org" Subject: RE: [PATCH] virtio-crypto: Fix an error handling path in virtio_crypto_alg_skcipher_close_session() Thread-Topic: [PATCH] virtio-crypto: Fix an error handling path in virtio_crypto_alg_skcipher_close_session() Thread-Index: AQHYbdzohrRhPI6eNU6IurU5BTsS/K0rzrHw Date: Mon, 23 May 2022 03:30:12 +0000 Message-ID: <544dc03a02ff46dbb62587f3343ffd72@huawei.com> References: <068d2824cf592748cbd9b75cf4cb6c29600e213c.1653224817.git.christophe.jaillet@wanadoo.fr> In-Reply-To: <068d2824cf592748cbd9b75cf4cb6c29600e213c.1653224817.git.christophe.jaillet@wanadoo.fr> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.149.11] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Christophe JAILLET [mailto:christophe.jaillet@wanadoo.fr] > Sent: Sunday, May 22, 2022 9:07 PM > To: dan.carpenter@oracle.com; Gonglei (Arei) ; > 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() > > 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 > --- > drivers/crypto/virtio/virtio_crypto_skcipher_algs.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > Reviewed-by: Gonglei Regards, -Gonglei > 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%llx\n", > ctrl_status->status, destroy_session->session_id); > > - return -EINVAL; > + err = -EINVAL; > + goto out; > } > > err = 0; > -- > 2.34.1