[SCSI] ibmvfc: Fix DMA mapping leak on memory allocation failure

There is currently a DMA mapping leak that can occur in the ibmvfc
driver if we fail to allocate a scatterlist. Fix this by unmapping
the scatterlist in the failure path. Additionally, only log an error
for a scatterlist allocation failure if the log level is greater
than the default, since this can occur when running Active Memory
Sharing and this is not considered an error.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

authored by Brian King and committed by James Bottomley 64b840dd f9932deb

+3 -1
+3 -1
drivers/scsi/ibmvscsi/ibmvfc.c
··· 1322 &evt->ext_list_token); 1323 1324 if (!evt->ext_list) { 1325 - scmd_printk(KERN_ERR, scmd, "Can't allocate memory for scatterlist\n"); 1326 return -ENOMEM; 1327 } 1328 }
··· 1322 &evt->ext_list_token); 1323 1324 if (!evt->ext_list) { 1325 + scsi_dma_unmap(scmd); 1326 + if (vhost->log_level > IBMVFC_DEFAULT_LOG_LEVEL) 1327 + scmd_printk(KERN_ERR, scmd, "Can't allocate memory for scatterlist\n"); 1328 return -ENOMEM; 1329 } 1330 }