Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759756AbcDERnh (ORCPT ); Tue, 5 Apr 2016 13:43:37 -0400 Received: from mx0b-0016ce01.pphosted.com ([67.231.156.153]:24636 "EHLO mx0b-0016ce01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759230AbcDERnf (ORCPT ); Tue, 5 Apr 2016 13:43:35 -0400 Date: Tue, 5 Apr 2016 13:43:20 -0400 From: Chad Dupuis X-X-Sender: cdupuis@administrators-macbook-pro.local To: Bastien Philbert CC: , , , , Subject: Re: [PATCH] bnx2fc: Fix locking requirements in bnx2fc_init_tgt In-Reply-To: <1459867006-19605-1-git-send-email-bastienphilbert@gmail.com> Message-ID: References: <1459867006-19605-1-git-send-email-bastienphilbert@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=5800 definitions=8126 signatures=670708 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 impostorscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603180000 definitions=main-1604050256 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1251 Lines: 37 On Tue, 5 Apr 2016, Bastien Philbert wrote: > This fixes the locking around the call to bnx2fc_alloc_id to comply > with the comments about this particular function's definition about > requiring the need to hold the hba mutex before and after calling > it. > Signed-off-by: Bastien Philbert > --- > 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 08ec318..f2988cd 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); > > Taking the mutex here is not needed as it is already taken in bnx2fc_rport_event_handler() in the call chain bnx2fc_rport_event_handler->bnx2fc_offload_session->bnx2fc_init_tgt->bnx2fc_alloc_conn_id