Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1219355

RE: [PATCH] csiostor:Fix backwards locking in the function __csio_unreg_rnode

From Anish Bhatt <anish@chelsio.com>
Newsgroups linux.kernel
Subject RE: [PATCH] csiostor:Fix backwards locking in the function __csio_unreg_rnode
Date 2015-09-05 00:50 +0200
Message-ID <q57XY-7hG-11@gated-at.bofh.it> (permalink)
References <q57XY-7hG-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> -----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 <xerofoify@gmail.com>
> ---
>  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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

RE: [PATCH] csiostor:Fix backwards locking in the function  __csio_unreg_rnode Anish Bhatt <anish@chelsio.com> - 2015-09-05 00:50 +0200

csiph-web