RE: [PATCH] csiostor:Fix locking requirements for function call in the function csio_alloc_rnode

From: Anish Bhatt
Date: Fri Sep 04 2015 - 18:46:48 EST


> -----Original Message-----
> From: Nicholas Krause [mailto:xerofoify@xxxxxxxxx]
> Sent: Thursday, September 3, 2015 10:44 AM
> To: JBottomley@xxxxxxxx
> Cc: hare@xxxxxxx; michaelc@xxxxxxxxxxx; davem@xxxxxxxxxxxxx; Anish
> Bhatt; Hariprasad S; linux-scsi@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx
> 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
>
> Signed-off-by: Nicholas Krause <xerofoify@xxxxxxxxx>
> ---
> drivers/scsi/csiostor/csio_rnode.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/csiostor/csio_rnode.c
> b/drivers/scsi/csiostor/csio_rnode.c
> index e9c3b04..85635f4 100644
> --- a/drivers/scsi/csiostor/csio_rnode.c
> +++ b/drivers/scsi/csiostor/csio_rnode.c
> @@ -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;
> --
> 2.1.4

NACK. Function called from csio_fcoe_fwevt_handler() with lock held.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/