diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2013-02-20 12:24:46 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-02-24 04:35:18 -0500 |
commit | e2bea6df3261dac1ae400452ddab07babb4fc5f3 (patch) | |
tree | 9a8e13d18658b3541510608ae1575b4156a00977 /drivers/scsi/hpsa.c | |
parent | a2dac136c40fe07861f8146434917031a8c301b1 (diff) |
[SCSI] hpsa: check for dma_mapping_error in hpsa_map_sg_chain_block
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r-- | drivers/scsi/hpsa.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 137ed3335415..38c8aa5e85b4 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -1131,7 +1131,7 @@ clean: | |||
1131 | return -ENOMEM; | 1131 | return -ENOMEM; |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | static void hpsa_map_sg_chain_block(struct ctlr_info *h, | 1134 | static int hpsa_map_sg_chain_block(struct ctlr_info *h, |
1135 | struct CommandList *c) | 1135 | struct CommandList *c) |
1136 | { | 1136 | { |
1137 | struct SGDescriptor *chain_sg, *chain_block; | 1137 | struct SGDescriptor *chain_sg, *chain_block; |
@@ -1144,8 +1144,15 @@ static void hpsa_map_sg_chain_block(struct ctlr_info *h, | |||
1144 | (c->Header.SGTotal - h->max_cmd_sg_entries); | 1144 | (c->Header.SGTotal - h->max_cmd_sg_entries); |
1145 | temp64 = pci_map_single(h->pdev, chain_block, chain_sg->Len, | 1145 | temp64 = pci_map_single(h->pdev, chain_block, chain_sg->Len, |
1146 | PCI_DMA_TODEVICE); | 1146 | PCI_DMA_TODEVICE); |
1147 | if (dma_mapping_error(&h->pdev->dev, temp64)) { | ||
1148 | /* prevent subsequent unmapping */ | ||
1149 | chain_sg->Addr.lower = 0; | ||
1150 | chain_sg->Addr.upper = 0; | ||
1151 | return -1; | ||
1152 | } | ||
1147 | chain_sg->Addr.lower = (u32) (temp64 & 0x0FFFFFFFFULL); | 1153 | chain_sg->Addr.lower = (u32) (temp64 & 0x0FFFFFFFFULL); |
1148 | chain_sg->Addr.upper = (u32) ((temp64 >> 32) & 0x0FFFFFFFFULL); | 1154 | chain_sg->Addr.upper = (u32) ((temp64 >> 32) & 0x0FFFFFFFFULL); |
1155 | return 0; | ||
1149 | } | 1156 | } |
1150 | 1157 | ||
1151 | static void hpsa_unmap_sg_chain_block(struct ctlr_info *h, | 1158 | static void hpsa_unmap_sg_chain_block(struct ctlr_info *h, |
@@ -2123,7 +2130,10 @@ static int hpsa_scatter_gather(struct ctlr_info *h, | |||
2123 | if (chained) { | 2130 | if (chained) { |
2124 | cp->Header.SGList = h->max_cmd_sg_entries; | 2131 | cp->Header.SGList = h->max_cmd_sg_entries; |
2125 | cp->Header.SGTotal = (u16) (use_sg + 1); | 2132 | cp->Header.SGTotal = (u16) (use_sg + 1); |
2126 | hpsa_map_sg_chain_block(h, cp); | 2133 | if (hpsa_map_sg_chain_block(h, cp)) { |
2134 | scsi_dma_unmap(cmd); | ||
2135 | return -1; | ||
2136 | } | ||
2127 | return 0; | 2137 | return 0; |
2128 | } | 2138 | } |
2129 | 2139 | ||