diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-08-09 14:22:17 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-10-15 16:21:10 -0400 |
commit | 4bbc1bdd010cbfcb749e4f947161ec3ab3337893 (patch) | |
tree | 77478b6c1bc693ba4dbddd4bd14c063846ec63c9 /drivers/firewire/fw-sbp2.c | |
parent | 09b12dd4e3caff165a0f17a2f3ebd2bbc8544cc6 (diff) |
firewire: fw-sbp2: fix another small generation access bug
queuecommand() looked at the remote and local node IDs before it read
the bus generation. The corresponding race with sbp2_reconnect updating
these data was probably impossible to happen though because the current
code blocks the SCSI layer during reconnection. However, better safe
than sorry, especially if someone later improves the code to not block
the SCSI layer.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-sbp2.c')
-rw-r--r-- | drivers/firewire/fw-sbp2.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 5d8411afcedb..ef0b9b419c27 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -1423,7 +1423,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |||
1423 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); | 1423 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); |
1424 | struct sbp2_command_orb *orb; | 1424 | struct sbp2_command_orb *orb; |
1425 | unsigned int max_payload; | 1425 | unsigned int max_payload; |
1426 | int retval = SCSI_MLQUEUE_HOST_BUSY; | 1426 | int generation, retval = SCSI_MLQUEUE_HOST_BUSY; |
1427 | 1427 | ||
1428 | /* | 1428 | /* |
1429 | * Bidirectional commands are not yet implemented, and unknown | 1429 | * Bidirectional commands are not yet implemented, and unknown |
@@ -1467,6 +1467,9 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |||
1467 | if (cmd->sc_data_direction == DMA_FROM_DEVICE) | 1467 | if (cmd->sc_data_direction == DMA_FROM_DEVICE) |
1468 | orb->request.misc |= cpu_to_be32(COMMAND_ORB_DIRECTION); | 1468 | orb->request.misc |= cpu_to_be32(COMMAND_ORB_DIRECTION); |
1469 | 1469 | ||
1470 | generation = device->generation; | ||
1471 | smp_rmb(); /* sbp2_map_scatterlist looks at tgt->address_high */ | ||
1472 | |||
1470 | if (scsi_sg_count(cmd) && sbp2_map_scatterlist(orb, device, lu) < 0) | 1473 | if (scsi_sg_count(cmd) && sbp2_map_scatterlist(orb, device, lu) < 0) |
1471 | goto out; | 1474 | goto out; |
1472 | 1475 | ||
@@ -1479,7 +1482,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |||
1479 | if (dma_mapping_error(device->card->device, orb->base.request_bus)) | 1482 | if (dma_mapping_error(device->card->device, orb->base.request_bus)) |
1480 | goto out; | 1483 | goto out; |
1481 | 1484 | ||
1482 | sbp2_send_orb(&orb->base, lu, lu->tgt->node_id, lu->generation, | 1485 | sbp2_send_orb(&orb->base, lu, lu->tgt->node_id, generation, |
1483 | lu->command_block_agent_address + SBP2_ORB_POINTER); | 1486 | lu->command_block_agent_address + SBP2_ORB_POINTER); |
1484 | retval = 0; | 1487 | retval = 0; |
1485 | out: | 1488 | out: |