Skip to content

Commit

Permalink
ice: Fix a memory leak in an error handling path in 'ice_pf_dcb_cfg()'
Browse files Browse the repository at this point in the history
If this 'kzalloc()' fails we must free some resources as in all the other
error handling paths of this function.

Fixes: 348048e ("ice: Implement iidc operations")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
  • Loading branch information
Christophe JAILLET authored and Tony Nguyen committed Jun 25, 2021
1 parent 70fa0a0 commit b81c191
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ethernet/intel/ice/ice_dcb_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,10 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)

/* Notify AUX drivers about impending change to TCs */
event = kzalloc(sizeof(*event), GFP_KERNEL);
if (!event)
return -ENOMEM;
if (!event) {
ret = -ENOMEM;
goto free_cfg;
}

set_bit(IIDC_EVENT_BEFORE_TC_CHANGE, event->type);
ice_send_event_to_aux(pf, event);
Expand Down

0 comments on commit b81c191

Please sign in to comment.