Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5543526rwb; Mon, 5 Dec 2022 00:05:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf5xK4uBU/0x2U/Y8bPi+MFveN0NHojqRqJsbstMcF/uJewAsB1DsAsnpWOyUp4v4YHvBMvw X-Received: by 2002:aa7:da10:0:b0:46c:43ff:6961 with SMTP id r16-20020aa7da10000000b0046c43ff6961mr10151361eds.14.1670227507127; Mon, 05 Dec 2022 00:05:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670227507; cv=none; d=google.com; s=arc-20160816; b=gZdrkZQwgwLExMPW8t8FWXX4gBsFcWvIbFOEHb5V7jjsRginq2OqNTWS7dqHlNMUaQ UV2EudN685tweF0Wff/xBy5ynEfMagmw3NS/J9PzRx4c5a710Zl80mZ2xkPbXsm1/KIY 6UfFNQFsbDcGY9iSHZFJPe/mzZuFND31hW9CZigZp1bAc0tEobq4Aita6U7kmItsHaiy 3cnnQ8740qZ4jazVe1pFlEqY9XmVNAC7w6yor0+jvsTGgg6gONasVfPMCjdTf5EGb5Uf g7IkPRD/FAXdPRm8PXmQU5OEvaBhZHZDs2Ohzwsjo3/rrl7exQxw13h0mXC4nFcw2jJh kVsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=JJ1nIJyBTj/HDHns+WuHa0joo35//HGm6nwurKdbcBg=; b=j/vK1Ma0yr4ebkaErEf4fW2nIPEkB5KzMY57HzJGAPVaNFx5d59MrGTkhQFn+hJNjL /NrpntDfORcuc9AdPhfTrFqC9v9YlXve68cQtndWSJeluE91zARt1DeU8393OBJvnkpA NKCKe5Jr2FtqFNUmKphirUHP/CvWmhEun7iwk+mb1KrhePiLLI2ZYNpeEEjRQdfdkC48 LSBlc/B7+1qhyMWyOMwoe4EK9Jvdbs8oyvEL8mepdhduiaj9fOlWjtOWg8vnfQ5jJPc5 uvbcOYSblnFcmkJpAY7noMm22992d19Zhi/lqYyxX5F21B97u958tRj4QdvXWDQ2XAqb PdcA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a056402191100b00461c9bb5205si12576110edz.152.2022.12.05.00.04.47; Mon, 05 Dec 2022 00:05:07 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231765AbiLEHip (ORCPT + 82 others); Mon, 5 Dec 2022 02:38:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbiLEHin (ORCPT ); Mon, 5 Dec 2022 02:38:43 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7349B4A7; Sun, 4 Dec 2022 23:38:41 -0800 (PST) Received: from dggpeml500006.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NQb1C2k6QzkXnx; Mon, 5 Dec 2022 15:35:11 +0800 (CST) Received: from localhost.localdomain (10.175.112.70) by dggpeml500006.china.huawei.com (7.185.36.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 5 Dec 2022 15:38:39 +0800 From: Zhang Changzhong To: Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michal Swiatkowski CC: Zhang Changzhong , , Subject: [PATCH net] ice: switch: fix potential memleak in ice_add_adv_recipe() Date: Mon, 5 Dec 2022 15:38:22 +0800 Message-ID: <1670225902-10923-1-git-send-email-zhangchangzhong@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.70] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500006.china.huawei.com (7.185.36.76) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 When ice_add_special_words() fails, the 'rm' is not released, which will lead to a memory leak. Fix this up by going to 'err_unroll' label. Compile tested only. Fixes: 8b032a55c1bd ("ice: low level support for tunnels") Signed-off-by: Zhang Changzhong --- drivers/net/ethernet/intel/ice/ice_switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 9b762f7..61f844d 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -5420,7 +5420,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, */ status = ice_add_special_words(rinfo, lkup_exts, ice_is_dvm_ena(hw)); if (status) - goto err_free_lkup_exts; + goto err_unroll; /* Group match words into recipes using preferred recipe grouping * criteria. -- 2.9.5