Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57458036 authored by Brian King's avatar Brian King Committed by James Bottomley
Browse files

[SCSI] ibmvstgt: move crq_queue_create to the end of initialization



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: default avatarBrian King <brking@linux.vnet.ibm.com>
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reported-by: default avatarOlaf Hering <olh@suse.de>
Cc: stable@kernel.org
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent d3acf022
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -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: