ibmvfc: Protect vhost->task_set increment by the host lock
Subsystems (3)
PATCH 1/1 ibmvfc: Protect vhost->task_set increment by the host lock
In the discovery thread, ibmvfc does a vhost->task_set++ without any lock held. This could result in two targets getting the same cancel key, which could have strange effects in error recovery. The actual probability of this occurring should be extremely small, since this should all be done in a single threaded loop from the discovery thread, but let's fix it up anyway to be safe.
--- drivers/scsi/ibmvscsi/ibmvfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ibmvscsi/ibmvfc.c +1 -1
@@ -4169,11 +4169,11 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vhost,struct ibmvfc_discover_ tgt->wwpn = wwpn; tgt->vhost = vhost; tgt->need_login =1 ; - tgt->cancel_key = vhost->task_set++;timer_setup (&tgt->timer, ibmvfc_adisc_timeout,0 );kref_init (&tgt->kref);ibmvfc_init_tgt (tgt, ibmvfc_tgt_implicit_logout);spin_lock_irqsave (vhost->host->host_lock, flags); + tgt->cancel_key = vhost->task_set++;list_add_tail (&tgt->queue, &vhost->targets); unlock_out:
Signature · 1 line
1.8.3.1
Martin K. Petersen
AppliedBrian,
Quoted 6 lines
In the discovery thread, ibmvfc does a vhost->task_set++ without any lock held. This could result in two targets getting the same cancel key, which could have strange effects in error recovery. The actual probability of this occurring should be extremely small, since this should all be done in a single threaded loop from the discovery thread, but let's fix it up anyway to be safe.
Applied to 5.10/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 6 lines · Brian King
In the discovery thread, ibmvfc does a vhost->task_set++ without any lock held. This could result in two targets getting the same cancel key, which could have strange effects in error recovery. The actual probability of this occurring should be extremely small, since this should all be done in a single threaded loop from the discovery thread, but let's fix it up anyway to be safe.
Applied to 5.10/scsi-queue, thanks!
[1/1] scsi: ibmvfc: Protect vhost->task_set increment by the host lock
https://git.kernel.org/mkp/scsi/c/2584e5aef87a
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering