From: Christophe JAILLET Date: Sun, 20 Jun 2021 13:28:06 +0000 (+0200) Subject: ice: Fix a memory leak in an error handling path in 'ice_pf_dcb_cfg()' X-Git-Tag: accepted/tizen/unified/20230118.172025~6942^2~28^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b81c191c468bb9f9e63cb19cdf090732e3218dce;p=platform%2Fkernel%2Flinux-rpi.git 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: 348048e724a0 ("ice: Implement iidc operations") Signed-off-by: Christophe JAILLET Signed-off-by: Tony Nguyen --- diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c index 857dc62..926cf74 100644 --- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c @@ -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);