Skip to content

Commit 7c8881b

Browse files
Jianglei Nieanguy11
Jianglei Nie
authored andcommitted
ice: Fix memory leak in ice_get_orom_civd_data()
A memory chunk was allocated for orom_data in ice_get_orom_civd_data() by vzmalloc(). But when ice_read_flash_module() fails, the allocated memory is not freed, which will lead to a memory leak. We can fix it by freeing the orom_data when ce_read_flash_module() fails. Fixes: af18d88 ("ice: reduce time to read Option ROM CIVD data") Signed-off-by: Jianglei Nie <[email protected]> Tested-by: Gurucharan <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent d201665 commit 7c8881b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
641641
status = ice_read_flash_module(hw, bank, ICE_SR_1ST_OROM_BANK_PTR, 0,
642642
orom_data, hw->flash.banks.orom_size);
643643
if (status) {
644+
vfree(orom_data);
644645
ice_debug(hw, ICE_DBG_NVM, "Unable to read Option ROM data\n");
645646
return status;
646647
}

0 commit comments

Comments
 (0)