Skip to contentSkip to conversation

csiostor:Fix backwards locking in the function __csio_unreg_rnode

PATCH Anish Bhatt 1 participant 1 message Sep 4, 2015 1 message not in the archive SCSI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Anish Bhatt

author NAK
#1 lore raw
Quoted 41 lines

-----Original Message-----
From: Nicholas Krause [mailto:[email protected]]
Sent: Thursday, September 3, 2015 10:09 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Anish Bhatt; Hariprasad S; [email protected]; linux- [email protected]
Subject: [PATCH] csiostor:Fix backwards locking in the function __csio_unreg_rnode

This fixes backwards locking in the function __csio_unreg_rnode to properly lock before the call to the function csio_unreg_rnode and not unlock with spin_unlock_irq as this would not allow the proper protection for concurrent access on the shared csio_hw structure pointer hw. In addition switch the locking after the critical region function call to properly unlock instead with spin_unlock_irq on the shared structure pointer.

---
 drivers/scsi/csiostor/csio_rnode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/csiostor/csio_rnode.c +2 -3
index e9c3b04..029a09e 100644
@@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode *rn)
 		ln->last_scan_ntgts--;
 	}
 
-	spin_unlock_irq(&hw->lock);
-	csio_unreg_rnode(rn);
 	spin_lock_irq(&hw->lock);
+	csio_unreg_rnode(rn);
+	spin_unlock_irq(&hw->lock);
 
 	/* Cleanup I/Os that were waiting for rnode to unregister */
 	if (cmpl)
--
Quoted 1 line

2.1.4

NACK, function is called with lock held.