libsas: Check for completed commands before calling lldd_abort_task()
Subsystems (2)
PATCH 1/1 libsas: Check for completed commands before calling lldd_abort_task()
The abort handler might be racing with command completion, so the task might already be NULL by the time the abort handler is called.
--- drivers/scsi/libsas/sas_scsi_host.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/libsas/sas_scsi_host.c +3 -2
@@ -486,7 +486,7 @@ static int sas_queue_reset(struct domain_device *dev, int reset_type,int sas_eh_abort_handler (struct scsi_cmnd *cmd) { -int res; +int res =TMF_RESP_FUNC_COMPLETE ;struct sas_task *task =TO_SAS_TASK (cmd);struct Scsi_Host *host = cmd->device->host;struct sas_internal *i =to_sas_internal (host->transportt);
@@ -494,7 +494,8 @@ int sas_eh_abort_handler(struct scsi_cmnd *cmd)if (!i->dft->lldd_abort_task)return FAILED ; - res = i->dft->lldd_abort_task (task); +if (task) + res = i->dft->lldd_abort_task (task);if (res ==TMF_RESP_FUNC_SUCC || res ==TMF_RESP_FUNC_COMPLETE )return SUCCESS ;
Signature · 1 line
1.8.5.6
Quoted 2 lines · Hannes Reinecke
The abort handler might be racing with command completion, so the task might already be NULL by the time the abort handler is called.
But without taking dev_done_lock (or using cmpxchg) what prevents use from still hitting this, although in a more narrow window?
Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Hannes Reinecke
The abort handler might be racing with command completion, so the task might already be NULL by the time the abort handler is called.
But without taking
dev_done_lock(or using cmpxchg) what prevents use from still hitting this, although in a more narrow window?
Good point.
Will be updating the patch.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)