Skip to content

Commit

Permalink
[SCSI] ibmvstgt: move crq_queue_create to the end of initialization
Browse files Browse the repository at this point in the history
Calling crq_queue_create could lead to the creation of a rport. We
need to set up everything before creating a rport. This moves
crq_queue_create to the end of initialization to avoid a race which
causes an oops if lost.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reported-by: Olaf Hering <olh@suse.de>
Cc: stable@kernel.org
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
  • Loading branch information
Brian King authored and James Bottomley committed Dec 9, 2008
1 parent d3acf02 commit 5745803
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions drivers/scsi/ibmvscsi/ibmvstgt.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,21 +864,23 @@ static int ibmvstgt_probe(struct vio_dev *dev, const struct vio_device_id *id)

INIT_WORK(&vport->crq_work, handle_crq);

err = crq_queue_create(&vport->crq_queue, target);
err = scsi_add_host(shost, target->dev);
if (err)
goto free_srp_target;

err = scsi_add_host(shost, target->dev);
err = scsi_tgt_alloc_queue(shost);
if (err)
goto destroy_queue;
goto remove_host;

err = scsi_tgt_alloc_queue(shost);
err = crq_queue_create(&vport->crq_queue, target);
if (err)
goto destroy_queue;
goto free_queue;

return 0;
destroy_queue:
crq_queue_destroy(target);
free_queue:
scsi_tgt_free_queue(shost);
remove_host:
scsi_remove_host(shost);
free_srp_target:
srp_target_free(target);
put_host:
Expand Down

0 comments on commit 5745803

Please sign in to comment.