ice: Fix a memory leak in an error handling path in 'ice_pf_dcb_cfg()'

If this 'kzalloc()' fails we must free some resources as in all the other
error handling paths of this function.

Fixes: 348048e724 ("ice: Implement iidc operations")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
Christophe JAILLET 2021-06-20 15:28:06 +02:00 committed by Tony Nguyen
parent 70fa0a0780
commit b81c191c46
1 changed files with 4 additions and 2 deletions

View File

@ -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 */ /* Notify AUX drivers about impending change to TCs */
event = kzalloc(sizeof(*event), GFP_KERNEL); event = kzalloc(sizeof(*event), GFP_KERNEL);
if (!event) if (!event) {
return -ENOMEM; ret = -ENOMEM;
goto free_cfg;
}
set_bit(IIDC_EVENT_BEFORE_TC_CHANGE, event->type); set_bit(IIDC_EVENT_BEFORE_TC_CHANGE, event->type);
ice_send_event_to_aux(pf, event); ice_send_event_to_aux(pf, event);