mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chad Dupuis <chad.dupuis@qlogic.com>
To: Nicholas Krause <xerofoify@gmail.com>
Cc: <QLogic-Storage-Upstream@qlogic.com>,
	<James.Bottomley@HansenPartnership.com>,
	<martin.petersen@oracle.com>, <linux-scsi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RESEND] bnx2fc:Fix locking requirements before calling the function bnx2fc_alloc_conn_id
Date: Mon, 18 Jan 2016 12:47:06 -0500	[thread overview]
Message-ID: <alpine.OSX.2.00.1601181246140.1367@administrators-macbook-pro.local> (raw)
In-Reply-To: <1452828262-23117-1-git-send-email-xerofoify@gmail.com>



On Thu, 14 Jan 2016, Nicholas Krause wrote:

> This fixes the locking requirements before calling the function
> bnx2fc_alloc_conn_id by locking the mutex hba_mutex of the
> structure pointer hba in the function bnx2fc_init_tgt as this
> is commented as required to be held by the caller of the function
> bnx2fc_alloc_conn_id. In addition we must also unlock this lock if
> either a error occurs inside the function bnx2fc_alloc_conn_id or
> this function exits successfully in order to avoid deadlock with
> other users of this mutex.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> drivers/scsi/bnx2fc/bnx2fc_tgt.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
> index c66c708..41fec79 100644
> --- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
> +++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
> @@ -368,9 +368,13 @@ static int bnx2fc_init_tgt(struct bnx2fc_rport *tgt,
> 		return -1;
> 	}
>
> +	mutex_lock(&hba->hba_mutex);
> 	tgt->fcoe_conn_id = bnx2fc_alloc_conn_id(hba, tgt);
> -	if (tgt->fcoe_conn_id == -1)
> +	if (tgt->fcoe_conn_id == -1) {
> +		mutex_unlock(&hba->hba_mutex);
> 		return -1;
> +	}
> +	mutex_unlock(&hba->hba_mutex);
>
> 	BNX2FC_TGT_DBG(tgt, "init_tgt - conn_id = 0x%x\n", tgt->fcoe_conn_id);
>
>

Nack, hba->hba_mutex is already taken in the bnx2fc_alloc_conn_id() so 
there is no need to take it in the caller.

           reply	other threads:[~2016-01-18 17:47 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1452828262-23117-1-git-send-email-xerofoify@gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.00.1601181246140.1367@administrators-macbook-pro.local \
    --to=chad.dupuis@qlogic.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=QLogic-Storage-Upstream@qlogic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=xerofoify@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®