]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[SCSI] ipr: Handler ID memory allocation failure at module load time
authorBrian King <brking@linux.vnet.ibm.com>
Fri, 11 Jan 2013 23:43:48 +0000 (17:43 -0600)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 29 Jan 2013 23:48:51 +0000 (10:48 +1100)
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/ipr.c

index 8d1b806f6022a0cad1d29eae7100f8b2b0b90e19..0a152ef8b741841ab5cfac9957ff940bc9b192cc 100644 (file)
@@ -8516,6 +8516,10 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg)
                                             BITS_TO_LONGS(ioa_cfg->max_devs_supported), GFP_KERNEL);
                ioa_cfg->vset_ids = kzalloc(sizeof(unsigned long) *
                                            BITS_TO_LONGS(ioa_cfg->max_devs_supported), GFP_KERNEL);
+
+               if (!ioa_cfg->target_ids || !ioa_cfg->array_ids
+                       || !ioa_cfg->vset_ids)
+                       goto out_free_res_entries;
        }
 
        for (i = 0; i < ioa_cfg->max_devs_supported; i++) {
@@ -8591,6 +8595,9 @@ out_free_vpd_cbs:
                            ioa_cfg->vpd_cbs, ioa_cfg->vpd_cbs_dma);
 out_free_res_entries:
        kfree(ioa_cfg->res_entries);
+       kfree(ioa_cfg->target_ids);
+       kfree(ioa_cfg->array_ids);
+       kfree(ioa_cfg->vset_ids);
        goto out;
 }