[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <86A17A977688E04689F40F6B1EC20EC60194111FCC@AVMB1.qlogic.org>
Date: Tue, 15 Dec 2015 19:51:34 +0000
From: Joe Carnuccio <joe.carnuccio@...gic.com>
To: Chad Dupuis <chad.dupuis@...gic.com>,
Nicholas Krause <xerofoify@...il.com>
CC: Dept-Eng QLogic Storage Upstream
<QLogic-Storage-Upstream@...gic.com>,
"JBottomley@...n.com" <JBottomley@...n.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
linux-scsi <linux-scsi@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] bnx2fc:Add proper locking protection in
bnx2fc_ctrlr_enabled
Also, the patch fails to do what it's message describes, i.e. the calls _bnx2fc_enable() and _bnx2fc_disable() are outside the lock/unlock.
-----Original Message-----
From: Chad Dupuis
Sent: Tuesday, December 15, 2015 8:43 AM
To: Nicholas Krause <xerofoify@...il.com>
Cc: Dept-Eng QLogic Storage Upstream <QLogic-Storage-Upstream@...gic.com>; JBottomley@...n.com; martin.petersen@...cle.com; linux-scsi <linux-scsi@...r.kernel.org>; linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] bnx2fc:Add proper locking protection in bnx2fc_ctrlr_enabled
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@...il.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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists