From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934084AbbIDWoe (ORCPT ); Fri, 4 Sep 2015 18:44:34 -0400 Received: from stargate.chelsio.com ([67.207.112.58]:23693 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933855AbbIDWod convert rfc822-to-8bit (ORCPT ); Fri, 4 Sep 2015 18:44:33 -0400 From: Anish Bhatt To: Nicholas Krause , "JBottomley@odin.com" , Praveen Madhavan CC: "hare@suse.de" , "michaelc@cs.wisc.edu" , "davem@davemloft.net" , Hariprasad S , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] csiostor:Fix backwards locking in the function __csio_unreg_rnode Thread-Topic: [PATCH] csiostor:Fix backwards locking in the function __csio_unreg_rnode Thread-Index: AQHQ5mtDqh0VJb/SZUig5Ib8OjHIGp4s+VEg Date: Fri, 4 Sep 2015 22:44:17 +0000 Message-ID: <525DB349B3FB5444AE057A887CB2A8D893E43743@nice.asicdesigners.com> References: <1441300143-1143-1-git-send-email-xerofoify@gmail.com> In-Reply-To: <1441300143-1143-1-git-send-email-xerofoify@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.192.161.23] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Nicholas Krause [mailto:xerofoify@gmail.com] > Sent: Thursday, September 3, 2015 10:09 AM > To: JBottomley@odin.com > Cc: hare@suse.de; michaelc@cs.wisc.edu; davem@davemloft.net; Anish > Bhatt; Hariprasad S; linux-scsi@vger.kernel.org; linux- > kernel@vger.kernel.org > 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. > > Signed-off-by: Nicholas Krause > --- > 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.1.4 NACK, function is called with lock held.