Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760153AbcDEVTL (ORCPT ); Tue, 5 Apr 2016 17:19:11 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:32800 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753371AbcDEVTJ (ORCPT ); Tue, 5 Apr 2016 17:19:09 -0400 From: Bastien Philbert To: jejb@linux.vnet.ibm.com Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode Date: Tue, 5 Apr 2016 17:19:03 -0400 Message-Id: <1459891143-20451-1-git-send-email-bastienphilbert@gmail.com> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1074 Lines: 30 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 Signed-off-by: Bastien Philbert --- drivers/scsi/csiostor/csio_rnode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/csiostor/csio_rnode.c b/drivers/scsi/csiostor/csio_rnode.c index e9c3b04..029a09e 100644 --- a/drivers/scsi/csiostor/csio_rnode.c +++ b/drivers/scsi/csiostor/csio_rnode.c @@ -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) -- 2.5.0