diff options
author | wenxiong@linux.vnet.ibm.com <wenxiong@linux.vnet.ibm.com> | 2013-03-14 14:52:25 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-05-12 18:07:42 -0400 |
commit | 222ab5946860e1d77870ffbfebebff2bcb1f4215 (patch) | |
tree | 6ed646b1b53667ad098a6440333543ca114019bb | |
parent | 364398324c901bc834f762eb5443d2e5a1d2a0db (diff) |
[SCSI] ipr: Avoid target_destroy accessing memory after it was freed
Defined target_ids,array_ids and vsets_ids as unsigned long to avoid
target_destroy accessing memory after it was freed.
Signed-off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/ipr.c | 16 | ||||
-rw-r--r-- | drivers/scsi/ipr.h | 6 |
2 files changed, 3 insertions, 19 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 82a3c1ec8706..6c4cedb44c07 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -8980,19 +8980,6 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg) | |||
8980 | if (!ioa_cfg->res_entries) | 8980 | if (!ioa_cfg->res_entries) |
8981 | goto out; | 8981 | goto out; |
8982 | 8982 | ||
8983 | if (ioa_cfg->sis64) { | ||
8984 | ioa_cfg->target_ids = kzalloc(sizeof(unsigned long) * | ||
8985 | BITS_TO_LONGS(ioa_cfg->max_devs_supported), GFP_KERNEL); | ||
8986 | ioa_cfg->array_ids = kzalloc(sizeof(unsigned long) * | ||
8987 | BITS_TO_LONGS(ioa_cfg->max_devs_supported), GFP_KERNEL); | ||
8988 | ioa_cfg->vset_ids = kzalloc(sizeof(unsigned long) * | ||
8989 | BITS_TO_LONGS(ioa_cfg->max_devs_supported), GFP_KERNEL); | ||
8990 | |||
8991 | if (!ioa_cfg->target_ids || !ioa_cfg->array_ids | ||
8992 | || !ioa_cfg->vset_ids) | ||
8993 | goto out_free_res_entries; | ||
8994 | } | ||
8995 | |||
8996 | for (i = 0; i < ioa_cfg->max_devs_supported; i++) { | 8983 | for (i = 0; i < ioa_cfg->max_devs_supported; i++) { |
8997 | list_add_tail(&ioa_cfg->res_entries[i].queue, &ioa_cfg->free_res_q); | 8984 | list_add_tail(&ioa_cfg->res_entries[i].queue, &ioa_cfg->free_res_q); |
8998 | ioa_cfg->res_entries[i].ioa_cfg = ioa_cfg; | 8985 | ioa_cfg->res_entries[i].ioa_cfg = ioa_cfg; |
@@ -9089,9 +9076,6 @@ out_free_vpd_cbs: | |||
9089 | ioa_cfg->vpd_cbs, ioa_cfg->vpd_cbs_dma); | 9076 | ioa_cfg->vpd_cbs, ioa_cfg->vpd_cbs_dma); |
9090 | out_free_res_entries: | 9077 | out_free_res_entries: |
9091 | kfree(ioa_cfg->res_entries); | 9078 | kfree(ioa_cfg->res_entries); |
9092 | kfree(ioa_cfg->target_ids); | ||
9093 | kfree(ioa_cfg->array_ids); | ||
9094 | kfree(ioa_cfg->vset_ids); | ||
9095 | goto out; | 9079 | goto out; |
9096 | } | 9080 | } |
9097 | 9081 | ||
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h index a1fb840596ef..07a85ce41782 100644 --- a/drivers/scsi/ipr.h +++ b/drivers/scsi/ipr.h | |||
@@ -1440,9 +1440,9 @@ struct ipr_ioa_cfg { | |||
1440 | /* | 1440 | /* |
1441 | * Bitmaps for SIS64 generated target values | 1441 | * Bitmaps for SIS64 generated target values |
1442 | */ | 1442 | */ |
1443 | unsigned long *target_ids; | 1443 | unsigned long target_ids[BITS_TO_LONGS(IPR_MAX_SIS64_DEVS)]; |
1444 | unsigned long *array_ids; | 1444 | unsigned long array_ids[BITS_TO_LONGS(IPR_MAX_SIS64_DEVS)]; |
1445 | unsigned long *vset_ids; | 1445 | unsigned long vset_ids[BITS_TO_LONGS(IPR_MAX_SIS64_DEVS)]; |
1446 | 1446 | ||
1447 | u16 type; /* CCIN of the card */ | 1447 | u16 type; /* CCIN of the card */ |
1448 | 1448 | ||