From: Kashyap, Desai Date: Mon, 5 Apr 2010 08:51:07 +0000 (+0530) Subject: [SCSI] mpt2sas: Check for NULL pointer before free_pages is added. X-Git-Tag: firefly_0821_release~9833^2~2084^2^2~95 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=66a679365780a8d775b1ed03e2576007f7100121;p=firefly-linux-kernel-4.4.55.git [SCSI] mpt2sas: Check for NULL pointer before free_pages is added. Added check before free_pages just to make sure ioc->scsi_lookup is not NULL. Signed-off-by: Kashyap Desai Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index b04ccad7d972..b830d61684dd 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -1919,7 +1919,10 @@ _base_release_memory_pools(struct MPT2SAS_ADAPTER *ioc) ioc->config_page, ioc->config_page_dma); } - free_pages((ulong)ioc->scsi_lookup, ioc->scsi_lookup_pages); + if (ioc->scsi_lookup) { + free_pages((ulong)ioc->scsi_lookup, ioc->scsi_lookup_pages); + ioc->scsi_lookup = NULL; + } kfree(ioc->hpr_lookup); kfree(ioc->internal_lookup); }