mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
SCSI: hpsa: fix a race in cmd_free/scsi_done
commit 2cc5bfaf85 upstream.
When the driver calls scsi_done and after that frees it's internal
preallocated memory it can happen that a new job is enqueud before
the memory is freed. The allocation fails and the message
"cmd_alloc returned NULL" is shown.
Patch below fixes it by moving cmd->scsi_done after cmd_free.
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Cc: Masoud Sharbiani <msharbiani@twitter.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
50e0289d81
commit
2e4ce49881
|
|
@ -1206,8 +1206,8 @@ static void complete_scsi_command(struct CommandList *cp)
|
|||
scsi_set_resid(cmd, ei->ResidualCnt);
|
||||
|
||||
if (ei->CommandStatus == 0) {
|
||||
cmd->scsi_done(cmd);
|
||||
cmd_free(h, cp);
|
||||
cmd->scsi_done(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1380,8 +1380,8 @@ static void complete_scsi_command(struct CommandList *cp)
|
|||
dev_warn(&h->pdev->dev, "cp %p returned unknown status %x\n",
|
||||
cp, ei->CommandStatus);
|
||||
}
|
||||
cmd->scsi_done(cmd);
|
||||
cmd_free(h, cp);
|
||||
cmd->scsi_done(cmd);
|
||||
}
|
||||
|
||||
static void hpsa_pci_unmap(struct pci_dev *pdev,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user