diff options
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 6 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_host_smp.c | 38 |
2 files changed, 21 insertions, 23 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 3da02e436788..6605ec905cc0 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -1936,12 +1936,8 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1936 | bio_data(rsp->bio), rsp->data_len); | 1936 | bio_data(rsp->bio), rsp->data_len); |
1937 | if (ret > 0) { | 1937 | if (ret > 0) { |
1938 | /* positive number is the untransferred residual */ | 1938 | /* positive number is the untransferred residual */ |
1939 | rsp->data_len = ret; | 1939 | rsp->resid_len = ret; |
1940 | req->data_len = 0; | ||
1941 | ret = 0; | 1940 | ret = 0; |
1942 | } else if (ret == 0) { | ||
1943 | rsp->data_len = 0; | ||
1944 | req->data_len = 0; | ||
1945 | } | 1941 | } |
1946 | 1942 | ||
1947 | return ret; | 1943 | return ret; |
diff --git a/drivers/scsi/libsas/sas_host_smp.c b/drivers/scsi/libsas/sas_host_smp.c index d110a366c48a..89952edd0be3 100644 --- a/drivers/scsi/libsas/sas_host_smp.c +++ b/drivers/scsi/libsas/sas_host_smp.c | |||
@@ -134,7 +134,7 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
134 | { | 134 | { |
135 | u8 *req_data = NULL, *resp_data = NULL, *buf; | 135 | u8 *req_data = NULL, *resp_data = NULL, *buf; |
136 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | 136 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); |
137 | int error = -EINVAL, resp_data_len = rsp->data_len; | 137 | int error = -EINVAL; |
138 | 138 | ||
139 | /* eight is the minimum size for request and response frames */ | 139 | /* eight is the minimum size for request and response frames */ |
140 | if (req->data_len < 8 || rsp->data_len < 8) | 140 | if (req->data_len < 8 || rsp->data_len < 8) |
@@ -176,17 +176,20 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
176 | resp_data[1] = req_data[1]; | 176 | resp_data[1] = req_data[1]; |
177 | resp_data[2] = SMP_RESP_FUNC_UNK; | 177 | resp_data[2] = SMP_RESP_FUNC_UNK; |
178 | 178 | ||
179 | req->resid_len = req->data_len; | ||
180 | rsp->resid_len = rsp->data_len; | ||
181 | |||
179 | switch (req_data[1]) { | 182 | switch (req_data[1]) { |
180 | case SMP_REPORT_GENERAL: | 183 | case SMP_REPORT_GENERAL: |
181 | req->data_len -= 8; | 184 | req->resid_len -= 8; |
182 | resp_data_len -= 32; | 185 | rsp->resid_len -= 32; |
183 | resp_data[2] = SMP_RESP_FUNC_ACC; | 186 | resp_data[2] = SMP_RESP_FUNC_ACC; |
184 | resp_data[9] = sas_ha->num_phys; | 187 | resp_data[9] = sas_ha->num_phys; |
185 | break; | 188 | break; |
186 | 189 | ||
187 | case SMP_REPORT_MANUF_INFO: | 190 | case SMP_REPORT_MANUF_INFO: |
188 | req->data_len -= 8; | 191 | req->resid_len -= 8; |
189 | resp_data_len -= 64; | 192 | rsp->resid_len -= 64; |
190 | resp_data[2] = SMP_RESP_FUNC_ACC; | 193 | resp_data[2] = SMP_RESP_FUNC_ACC; |
191 | memcpy(resp_data + 12, shost->hostt->name, | 194 | memcpy(resp_data + 12, shost->hostt->name, |
192 | SAS_EXPANDER_VENDOR_ID_LEN); | 195 | SAS_EXPANDER_VENDOR_ID_LEN); |
@@ -199,13 +202,13 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
199 | break; | 202 | break; |
200 | 203 | ||
201 | case SMP_DISCOVER: | 204 | case SMP_DISCOVER: |
202 | req->data_len -= 16; | 205 | req->resid_len -= 16; |
203 | if ((int)req->data_len < 0) { | 206 | if ((int)req->resid_len < 0) { |
204 | req->data_len = 0; | 207 | req->resid_len = 0; |
205 | error = -EINVAL; | 208 | error = -EINVAL; |
206 | goto out; | 209 | goto out; |
207 | } | 210 | } |
208 | resp_data_len -= 56; | 211 | rsp->resid_len -= 56; |
209 | sas_host_smp_discover(sas_ha, resp_data, req_data[9]); | 212 | sas_host_smp_discover(sas_ha, resp_data, req_data[9]); |
210 | break; | 213 | break; |
211 | 214 | ||
@@ -215,13 +218,13 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
215 | break; | 218 | break; |
216 | 219 | ||
217 | case SMP_REPORT_PHY_SATA: | 220 | case SMP_REPORT_PHY_SATA: |
218 | req->data_len -= 16; | 221 | req->resid_len -= 16; |
219 | if ((int)req->data_len < 0) { | 222 | if ((int)req->resid_len < 0) { |
220 | req->data_len = 0; | 223 | req->resid_len = 0; |
221 | error = -EINVAL; | 224 | error = -EINVAL; |
222 | goto out; | 225 | goto out; |
223 | } | 226 | } |
224 | resp_data_len -= 60; | 227 | rsp->resid_len -= 60; |
225 | sas_report_phy_sata(sas_ha, resp_data, req_data[9]); | 228 | sas_report_phy_sata(sas_ha, resp_data, req_data[9]); |
226 | break; | 229 | break; |
227 | 230 | ||
@@ -238,13 +241,13 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
238 | break; | 241 | break; |
239 | 242 | ||
240 | case SMP_PHY_CONTROL: | 243 | case SMP_PHY_CONTROL: |
241 | req->data_len -= 44; | 244 | req->resid_len -= 44; |
242 | if ((int)req->data_len < 0) { | 245 | if ((int)req->resid_len < 0) { |
243 | req->data_len = 0; | 246 | req->resid_len = 0; |
244 | error = -EINVAL; | 247 | error = -EINVAL; |
245 | goto out; | 248 | goto out; |
246 | } | 249 | } |
247 | resp_data_len -= 8; | 250 | rsp->resid_len -= 8; |
248 | sas_phy_control(sas_ha, req_data[9], req_data[10], | 251 | sas_phy_control(sas_ha, req_data[9], req_data[10], |
249 | req_data[32] >> 4, req_data[33] >> 4, | 252 | req_data[32] >> 4, req_data[33] >> 4, |
250 | resp_data); | 253 | resp_data); |
@@ -265,7 +268,6 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req, | |||
265 | flush_kernel_dcache_page(bio_page(rsp->bio)); | 268 | flush_kernel_dcache_page(bio_page(rsp->bio)); |
266 | kunmap_atomic(buf - bio_offset(rsp->bio), KM_USER0); | 269 | kunmap_atomic(buf - bio_offset(rsp->bio), KM_USER0); |
267 | local_irq_enable(); | 270 | local_irq_enable(); |
268 | rsp->data_len = resp_data_len; | ||
269 | 271 | ||
270 | out: | 272 | out: |
271 | kfree(req_data); | 273 | kfree(req_data); |