If allocating a VSI to a VSIG fails the local allocations made for VSIG
profiles and change-lists will not be removed. Adding calls to free
these entries on error in VSIG management calls.
Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
Reviewed-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
/* allocate the TCAM entry index */
status = ice_alloc_tcam_ent(hw, blk, &tcam_idx);
/* allocate the TCAM entry index */
status = ice_alloc_tcam_ent(hw, blk, &tcam_idx);
+ if (status) {
+ ice_free(hw, p);
goto err_ice_add_prof_id_vsig;
goto err_ice_add_prof_id_vsig;
t->tcam[i].ptg = ptg;
t->tcam[i].prof_id = map->prof_id;
t->tcam[i].ptg = ptg;
t->tcam[i].prof_id = map->prof_id;
err_ice_add_prof_id_vsig:
/* let caller clean up the change list */
err_ice_add_prof_id_vsig:
/* let caller clean up the change list */
return ICE_ERR_NO_MEMORY;
}
return ICE_ERR_NO_MEMORY;
}
return ICE_ERR_NO_MEMORY;
new_vsig = ice_vsig_alloc(hw, blk);
return ICE_ERR_NO_MEMORY;
new_vsig = ice_vsig_alloc(hw, blk);
- if (!new_vsig)
- return ICE_ERR_HW_TABLE;
+ if (!new_vsig) {
+ status = ICE_ERR_HW_TABLE;
+ goto err_ice_create_prof_id_vsig;
+ }
status = ice_move_vsi(hw, blk, vsi, new_vsig, chg);
if (status)
status = ice_move_vsi(hw, blk, vsi, new_vsig, chg);
if (status)
+ goto err_ice_create_prof_id_vsig;
status = ice_add_prof_id_vsig(hw, blk, new_vsig, hdl, chg);
if (status)
status = ice_add_prof_id_vsig(hw, blk, new_vsig, hdl, chg);
if (status)
+ goto err_ice_create_prof_id_vsig;
p->type = ICE_VSIG_ADD;
p->vsi = vsi;
p->type = ICE_VSIG_ADD;
p->vsi = vsi;
LIST_ADD(&p->list_entry, chg);
return ICE_SUCCESS;
LIST_ADD(&p->list_entry, chg);
return ICE_SUCCESS;
+
+err_ice_create_prof_id_vsig:
+ /* let caller clean up the change list */
+ ice_free(hw, p);
+ return status;