Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965270AbbLOQnE (ORCPT ); Tue, 15 Dec 2015 11:43:04 -0500 Received: from mx0b-0016ce01.pphosted.com ([67.231.156.153]:16234 "EHLO mx0b-0016ce01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965215AbbLOQnB (ORCPT ); Tue, 15 Dec 2015 11:43:01 -0500 Date: Tue, 15 Dec 2015 11:42:40 -0500 From: Chad Dupuis X-X-Sender: cdupuis@administrators-macbook-pro.local To: Nicholas Krause CC: , , , , Subject: Re: [PATCH] bnx2fc:Add proper locking protection in bnx2fc_ctrlr_enabled In-Reply-To: <1449949166-3977-1-git-send-email-xerofoify@gmail.com> Message-ID: References: <1449949166-3977-1-git-send-email-xerofoify@gmail.com> User-Agent: Alpine 2.00 (OSX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="US-ASCII" X-Originating-IP: [10.1.4.10] disclaimer: bypass X-Proofpoint-Virus-Version: vendor=nai engine=5700 definitions=8016 signatures=670673 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310007 definitions=main-1512150272 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1632 Lines: 48 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 > --- > 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/