Skip to contentSkip to conversation

ibmvfc: Fix a locking imbalance

PATCH In review Bart Van Assche 2 participants 2 messages Mar 4, 2015 – Mar 5, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ibmvfc: Fix a locking imbalance

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

Cc Brian King <[email protected]>
Cc Nathan Fontenot <[email protected]>
Cc Tyrel Datwyler <[email protected]>
---
 drivers/scsi/ibmvscsi/ibmvfc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/ibmvscsi/ibmvfc.c +2 -0
index 057d277..b46257a 100644
@@ -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);
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Bart Van Assche
drivers/scsi/ibmvscsi/ibmvfc.c +0 -0
index 057d277..b46257a 100644

drivers/scsi/ibmvscsi/ibmvfc.c static void ibmvfc_rport_add_thread(struct work_struct *work) · line 4729

Quoted 8 lines
drivers/scsi/ibmvscsi/ibmvfc.c +2 -0
@@ -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.

Signature · 3 lines
Brian King
Power Linux I/O
IBM Linux Technology Center