* Re: [PATCH] bnx2fc:Add proper locking protection in bnx2fc_ctrlr_enabled
[not found] <1449949166-3977-1-git-send-email-xerofoify@gmail.com>
@ 2015-12-15 16:42 ` Chad Dupuis
2015-12-15 19:51 ` Joe Carnuccio
0 siblings, 1 reply; 2+ messages in thread
From: Chad Dupuis @ 2015-12-15 16:42 UTC (permalink / raw)
To: Nicholas Krause
Cc: QLogic-Storage-Upstream, JBottomley, martin.petersen, linux-scsi,
linux-kernel
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] bnx2fc:Add proper locking protection in bnx2fc_ctrlr_enabled
2015-12-15 16:42 ` [PATCH] bnx2fc:Add proper locking protection in bnx2fc_ctrlr_enabled Chad Dupuis
@ 2015-12-15 19:51 ` Joe Carnuccio
0 siblings, 0 replies; 2+ messages in thread
From: Joe Carnuccio @ 2015-12-15 19:51 UTC (permalink / raw)
To: Chad Dupuis, Nicholas Krause
Cc: Dept-Eng QLogic Storage Upstream, JBottomley, martin.petersen,
linux-scsi, linux-kernel
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@gmail.com>
Cc: Dept-Eng QLogic Storage Upstream <QLogic-Storage-Upstream@qlogic.com>; JBottomley@odin.com; martin.petersen@oracle.com; linux-scsi <linux-scsi@vger.kernel.org>; linux-kernel <linux-kernel@vger.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@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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-15 19:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1449949166-3977-1-git-send-email-xerofoify@gmail.com>
2015-12-15 16:42 ` [PATCH] bnx2fc:Add proper locking protection in bnx2fc_ctrlr_enabled Chad Dupuis
2015-12-15 19:51 ` Joe Carnuccio
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®