net/ice: fix memory leak when releasing VSI
authorYunjian Wang <wangyunjian@huawei.com>
Tue, 28 Jul 2020 13:11:12 +0000 (21:11 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 29 Jul 2020 22:41:23 +0000 (00:41 +0200)
At the end of the vsi release, we should free the 'rss_lut'
and 'rss_key' for the vsi.

Fixes: 50370662b727 ("net/ice: support device and queue ops")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_ethdev.c

index c4c0e63..a29c9ad 100644 (file)
@@ -2280,9 +2280,10 @@ ice_release_vsi(struct ice_vsi *vsi)
        struct ice_hw *hw;
        struct ice_vsi_ctx vsi_ctx;
        enum ice_status ret;
        struct ice_hw *hw;
        struct ice_vsi_ctx vsi_ctx;
        enum ice_status ret;
+       int error = 0;
 
        if (!vsi)
 
        if (!vsi)
-               return 0;
+               return error;
 
        hw = ICE_VSI_TO_HW(vsi);
 
 
        hw = ICE_VSI_TO_HW(vsi);
 
@@ -2295,12 +2296,13 @@ ice_release_vsi(struct ice_vsi *vsi)
        ret = ice_free_vsi(hw, vsi->idx, &vsi_ctx, false, NULL);
        if (ret != ICE_SUCCESS) {
                PMD_INIT_LOG(ERR, "Failed to free vsi by aq, %u", vsi->vsi_id);
        ret = ice_free_vsi(hw, vsi->idx, &vsi_ctx, false, NULL);
        if (ret != ICE_SUCCESS) {
                PMD_INIT_LOG(ERR, "Failed to free vsi by aq, %u", vsi->vsi_id);
-               rte_free(vsi);
-               return -1;
+               error = -1;
        }
 
        }
 
+       rte_free(vsi->rss_lut);
+       rte_free(vsi->rss_key);
        rte_free(vsi);
        rte_free(vsi);
-       return 0;
+       return error;
 }
 
 void
 }
 
 void