Re: [PATCH] bnx2fc: do not scan uninitialized lists in case of error.

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

 



On Thu, 2014-06-19 at 15:05 +0200, Maurizio Lombardi wrote:
> In case of of error, the bnx2fc_cmd_mgr_alloc() function will call
> the bnx2fc_cmd_mgr_free() to perform the cleanup.
> The problem is that in one case the latter may try to scan
> some not-yet initialized lists, resulting in a kernel panic.
> 
> This patch prevents this from happening by freeing the lists
> before calling bnx2fc_cmd_mgr_free().
> 
> Signed-off-by: Maurizio Lombardi <mlombard@xxxxxxxxxx>
> ---
>  drivers/scsi/bnx2fc/bnx2fc_io.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
> index 32a5e0a..7bc47fc 100644
> --- a/drivers/scsi/bnx2fc/bnx2fc_io.c
> +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
> @@ -282,6 +282,8 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
>  				       arr_sz, GFP_KERNEL);
>  	if (!cmgr->free_list_lock) {
>  		printk(KERN_ERR PFX "failed to alloc free_list_lock\n");
> +		kfree(cmgr->free_list);
> +		cmgr->free_list = NULL;
>  		goto mem_err;
>  	}
>  
Agreed.  Thanks for fixing this, Maurizio.

Acked-by: Eddie Wai <eddie.wai@xxxxxxxxxxxx>


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux