From: Chad Dupuis <chad.dupuis@qlogic.com>
To: Nicholas Krause <xerofoify@gmail.com>
Cc: <QLogic-Storage-Upstream@qlogic.com>, <JBottomley@odin.com>,
<martin.petersen@oracle.com>, <linux-scsi@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bnx2fc:Add proper locking protection in bnx2fc_ctrlr_enabled
Date: Tue, 15 Dec 2015 11:42:40 -0500 [thread overview]
Message-ID: <alpine.OSX.2.00.1512151139140.1614@administrators-macbook-pro.local> (raw)
In-Reply-To: <1449949166-3977-1-git-send-email-xerofoify@gmail.com>
On Sat, 12 Dec 2015, Nicholas Krause wrote:
> This adds proper locking protection in bnx2fc_ctrl_enabled around
> the calls to the functions, _bnx2fc_enable and _bnx2fc_disable in
> order to avoid concurrent access on these functions accessing global
> referenced data structures in their internal intended work.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> index 67405c6..e43648f 100644
> --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> @@ -2177,13 +2177,21 @@ static int bnx2fc_ctlr_enabled(struct fcoe_ctlr_device *cdev)
> {
> struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(cdev);
>
> + rtnl_lock();
> + mutex_lock(&bnx2fc_dev_lock);
> switch (cdev->enabled) {
> case FCOE_CTLR_ENABLED:
> + rtnl_unlock();
> + mutex_unlock(&bnx2fc_dev_lock);
> return __bnx2fc_enable(ctlr);
> case FCOE_CTLR_DISABLED:
> + rtnl_unlock();
> + mutex_unlock(&bnx2fc_dev_lock);
> return __bnx2fc_disable(ctlr);
> case FCOE_CTLR_UNUSED:
> default:
> + rtnl_unlock();
> + mutex_unlock(&bnx2fc_dev_lock);
> return -ENOTSUPP;
> };
> }
>
Nack. All we end up protecting is the check of cdev->enabled and I do not
believe taking two mutexes is required for that.
next parent reply other threads:[~2015-12-15 16:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1449949166-3977-1-git-send-email-xerofoify@gmail.com>
2015-12-15 16:42 ` Chad Dupuis [this message]
2015-12-15 19:51 ` Joe Carnuccio
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.1512151139140.1614@administrators-macbook-pro.local \
--to=chad.dupuis@qlogic.com \
--cc=JBottomley@odin.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®