Skip to content

Commit b81c191

Browse files
tititiou36anguy11
authored andcommitted
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: 348048e ("ice: Implement iidc operations") Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 70fa0a0 commit b81c191

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/net/ethernet/intel/ice/ice_dcb_lib.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,10 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)
316316

317317
/* Notify AUX drivers about impending change to TCs */
318318
event = kzalloc(sizeof(*event), GFP_KERNEL);
319-
if (!event)
320-
return -ENOMEM;
319+
if (!event) {
320+
ret = -ENOMEM;
321+
goto free_cfg;
322+
}
321323

322324
set_bit(IIDC_EVENT_BEFORE_TC_CHANGE, event->type);
323325
ice_send_event_to_aux(pf, event);

0 commit comments

Comments
 (0)