Skip to contentSkip to conversation

csiostor:Fix locking requirements for function call in the function csio_alloc_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]

#1 lore raw
Quoted 44 lines

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

This fixes locking requirements for the function call to the function csio_rnode_init to properly lock and disable irqs before calling this function with spin_lock_irq on the structure pointer hw of type csio_hw and unlocking after the function call with spin_unlock_irq in order to prevent concurrent access on the shared structure pointer hw of type csio_hw with other threads of execution accessing this structure

---
 drivers/scsi/csiostor/csio_rnode.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/csiostor/csio_rnode.c +6 -3
index e9c3b04..85635f4 100644
@@ -222,9 +222,13 @@ csio_alloc_rnode(struct csio_lnode *ln)
 		goto err;
 
 	memset(rn, 0, sizeof(struct csio_rnode));
-	if (csio_rnode_init(rn, ln))
+	spin_lock_irq(&hw->lock);
+	if (csio_rnode_init(rn, ln)) {
+		spin_unlock_irq(&hw->lock);
 		goto err_free;
-
+	}
+
+	spin_unlock_irq(&hw->lock);
 	CSIO_INC_STATS(ln, n_rnode_alloc);
 
 	return rn;
--
Quoted 1 line

2.1.4

NACK. Function called from csio_fcoe_fwevt_handler() with lock held.