Patch "ice: Fix memory leak in ice_get_orom_civd_data()" has been added to the 5.17-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ice: Fix memory leak in ice_get_orom_civd_data()

to the 5.17-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ice-fix-memory-leak-in-ice_get_orom_civd_data.patch
and it can be found in the queue-5.17 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e3971257b53fafc0706f2dadfaf60db70c045bd4
Author: Jianglei Nie <niejianglei2021@xxxxxxx>
Date:   Sat Apr 2 10:17:15 2022 +0800

    ice: Fix memory leak in ice_get_orom_civd_data()
    
    [ Upstream commit 7c8881b77908a51814a050da408c89f1a25b7fb7 ]
    
    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: af18d8866c80 ("ice: reduce time to read Option ROM CIVD data")
    Signed-off-by: Jianglei Nie <niejianglei2021@xxxxxxx>
    Tested-by: Gurucharan <gurucharanx.g@xxxxxxxxx> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/ice/ice_nvm.c b/drivers/net/ethernet/intel/ice/ice_nvm.c
index 4eb0599714f4..13cdb5ea594d 100644
--- a/drivers/net/ethernet/intel/ice/ice_nvm.c
+++ b/drivers/net/ethernet/intel/ice/ice_nvm.c
@@ -641,6 +641,7 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
 	status = ice_read_flash_module(hw, bank, ICE_SR_1ST_OROM_BANK_PTR, 0,
 				       orom_data, hw->flash.banks.orom_size);
 	if (status) {
+		vfree(orom_data);
 		ice_debug(hw, ICE_DBG_NVM, "Unable to read Option ROM data\n");
 		return status;
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux