Re: [PATCH 04/10] aacraid: Fix memory leak in aac_fib_map_free

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

 



On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote:
> From: Raghava Aditya Renukunta <raghavaaditya.renukunta@xxxxxxxx>
> 
> aac_fib_map_free() calls pci_free_consistent() without checking that
> dev->hw_fib_va is not NULL and dev->max_fib_size is not zero.If they
> are indeed NULL/0, this will result in a hang as pci_free_consistent()
> will attempt to invalidate cache for the entire 64-bit address space
> (which would take a very long time).
> 
> Fixed by adding a check to make sure that dev->hw_fib_va and
> dev->max_fib_size are not NULL and 0 respectively.
> 
> Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@xxxxxxxx>
> ---
>  drivers/scsi/aacraid/commsup.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
> index b257d3b..9533f47 100644
> --- a/drivers/scsi/aacraid/commsup.c
> +++ b/drivers/scsi/aacraid/commsup.c
> @@ -83,9 +83,12 @@ static int fib_map_alloc(struct aac_dev *dev)
>  
>  void aac_fib_map_free(struct aac_dev *dev)
>  {
> -	pci_free_consistent(dev->pdev,
> -	  dev->max_fib_size * (dev->scsi_host_ptr->can_queue +
> AAC_NUM_MGT_FIB),
> -	  dev->hw_fib_va, dev->hw_fib_pa);
> +	if (dev->hw_fib_va && dev->max_fib_size) {
> +		pci_free_consistent(dev->pdev,
> +		(dev->max_fib_size *
> +		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)),
> +		dev->hw_fib_va, dev->hw_fib_pa);
> +	}
>  	dev->hw_fib_va = NULL;
>  	dev->hw_fib_pa = 0;
>  }

Fixes: 9ad5204d6 - "[SCSI] aacraid: incorrect dma mapping mask during blinkled
recover or user initiated reset"
Cc: stable@xxxxxxxxxxxxxxx
Reviewed-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
--
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