public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ibmvfc: Fix a locking imbalance
@ 2015-03-04 10:03 Bart Van Assche
  2015-03-05 13:35 ` Brian King
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2015-03-04 10:03 UTC (permalink / raw)
  To: James Bottomley
  Cc: Brian King, Nathan Fontenot, Tyrel Datwyler,
	linux-scsi@vger.kernel.org

Avoid that the spin_lock() statement after kref_put() triggers a
lockup if rport != NULL && get_device() == 0. Detected by sparse.
Compile-tested only.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Brian King <brking@linux.vnet.ibm.com>
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Cc: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 drivers/scsi/ibmvscsi/ibmvfc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 057d277..b46257a 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -4722,6 +4722,8 @@ static void ibmvfc_rport_add_thread(struct work_struct *work)
 					tgt_dbg(tgt, "Setting rport roles\n");
 					fc_remote_port_rolechg(rport, tgt->ids.roles);
 					put_device(&rport->dev);
+				} else {
+					spin_unlock_irqrestore(vhost->host->host_lock, flags);
 				}
 
 				kref_put(&tgt->kref, ibmvfc_release_tgt);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ibmvfc: Fix a locking imbalance
  2015-03-04 10:03 [PATCH] ibmvfc: Fix a locking imbalance Bart Van Assche
@ 2015-03-05 13:35 ` Brian King
  0 siblings, 0 replies; 2+ messages in thread
From: Brian King @ 2015-03-05 13:35 UTC (permalink / raw)
  To: Bart Van Assche, James Bottomley
  Cc: Nathan Fontenot, Tyrel Datwyler, linux-scsi@vger.kernel.org

On 03/04/2015 04:03 AM, Bart Van Assche wrote:
> diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
> index 057d277..b46257a 100644
> --- a/drivers/scsi/ibmvscsi/ibmvfc.c
> +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
> @@ -4722,6 +4722,8 @@ static void ibmvfc_rport_add_thread(struct work_struct *work)
>  					tgt_dbg(tgt, "Setting rport roles\n");
>  					fc_remote_port_rolechg(rport, tgt->ids.roles);
>  					put_device(&rport->dev);
> +				} else {
> +					spin_unlock_irqrestore(vhost->host->host_lock, flags);
>  				}
> 
>  				kref_put(&tgt->kref, ibmvfc_release_tgt);
> 

Nice catch. Thanks.

Reviewed-by: Brian King <brking@linux.vnet.ibm.com>


-- 
Brian King
Power Linux I/O
IBM Linux Technology Center



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-05 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-04 10:03 [PATCH] ibmvfc: Fix a locking imbalance Bart Van Assche
2015-03-05 13:35 ` Brian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox