Message ID | 1700930141-5568-1-git-send-email-sbhatta@marvell.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp2041032vqx; Sat, 25 Nov 2023 08:36:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2XSv42udxDLmRJ4LXaBIIXu/MggNd84zM/ujIMZlY2E9CPOZA/pvqRfgzqIpbsGxHohAn X-Received: by 2002:a17:902:d50c:b0:1cf:78a6:d61 with SMTP id b12-20020a170902d50c00b001cf78a60d61mr6355163plg.9.1700930199959; Sat, 25 Nov 2023 08:36:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700930199; cv=none; d=google.com; s=arc-20160816; b=rBGrJngX+xAL5puFeIHV7WBbM6PQosG3/AnyyLk8B3LiO34/q86NL2k2luZKMldEkr pSbQwfT51az55cK+pUTu9pSpk3F63qv4O2vdWQvJNqBbIsURSCYn+qOCoaOCy1htw6I4 dQDhXAGRab5cT92BVRngwczAOB5sJHvGTMWdtJzFx6SrbxM62ch/Oxmfh9/mshyxlsu8 MBZ4ZGZxN2f5yIRfwJ5Gk0lnUUt+5K3dJs46PavVX0f4dk/N9wbxCUBdNyU7lnD2+xJR X1GBfILL4wa3zmHDe6PhKmhLIvUgfh+cYGM9SVMco37Ukt+KHr3UmK6TmYO5Hq2Kmtyq r2dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=9ko12hy6RH7NAQXfAVgeMRqXNaNI7sh28jkGvrWea2A=; fh=XH5TQEuSqvRK8iWR7cgl1LZixvfhe5JTwhFT61cZd0M=; b=mAk5WTLD1NLbFBBbH3i7XyYh2xgr6o2Yus37RxTEwlbj+ZoBnxfJAjhSPqI8k1iE67 DDqCeN2SLTvm7xyFWjxmb+wjfKx97wvf+JSSQzLifC2t6DKClJsGSLsymv5RCLT57jVc sE+fkNCEccUXcu/nc1y1v3HhrBu6LbaShsMoU1CKCK1OXBfhpnbVuBjoDPnXFc2utt3Y LGEF9T88IHyfRSvn/AdsDOjV1hirp3FI1MG4Z/bMUlMOXRR9rZ/uC8dl/kUkHvzbQC/N NkSM6LsNn6/YmLn25iADn1qusmdPibxWfeDTVcDQqvwieyn8eKD3nV9aPVlLqEXgyexS Zslw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="jg/FK7mb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id u11-20020a170902bf4b00b001c9dd045ef5si5564769pls.327.2023.11.25.08.36.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 08:36:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="jg/FK7mb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5B859809F393; Sat, 25 Nov 2023 08:36:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232305AbjKYQgB (ORCPT <rfc822;kernel.ruili@gmail.com> + 99 others); Sat, 25 Nov 2023 11:36:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232420AbjKYQfs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 25 Nov 2023 11:35:48 -0500 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33CAAD57; Sat, 25 Nov 2023 08:35:55 -0800 (PST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3APGOmAn027133; Sat, 25 Nov 2023 08:35:48 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=9ko12hy6RH7NAQXfAVgeMRqXNaNI7sh28jkGvrWea2A=; b=jg/FK7mb4S1Zq4Qaz061Lw0Hz5/ZW7jyykuO26l1Xu/KEJ8yOz8MRxQmDglkIGvdE1/r UAxe+84qMTdDApVNdagajWXRUnqw0IzJheYdZYhMR/P+rnMr9gd42O9ZjKK8JkQx9H7b lxwG4WG4YdbnCDJF47jn51zviljNe3gZPG2n8dVz4bWRB0FefpyxQMrbBagQaKb+Fn7Y DH1oj/prkNqANDPemjoxGbqZkH4ELfYCdLdxFx893c159zwO2VQy+9e9D1/3W5v6/5BJ kE7AAJqShRk3lKwzuOhOtGOJ9lx2tEnYwE/YxlvODuiUbsWB99ZtX7OmpnDFq5fbzujp NA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3ukhauga8p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 25 Nov 2023 08:35:48 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sat, 25 Nov 2023 08:35:46 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sat, 25 Nov 2023 08:35:46 -0800 Received: from hyd1358.marvell.com (unknown [10.29.37.11]) by maili.marvell.com (Postfix) with ESMTP id F102C5C68EA; Sat, 25 Nov 2023 08:35:42 -0800 (PST) From: Subbaraya Sundeep <sbhatta@marvell.com> To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <kuba@kernel.org>, <davem@davemloft.net>, <pabeni@redhat.com>, <edumazet@google.com>, <sgoutham@marvell.com>, <gakula@marvell.com>, <hkelam@marvell.com>, Subbaraya Sundeep <sbhatta@marvell.com> Subject: [PATCH net] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam Date: Sat, 25 Nov 2023 22:05:41 +0530 Message-ID: <1700930141-5568-1-git-send-email-sbhatta@marvell.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: cue_y-qazPCNjCi9FU_TAdMK1cJo0UhR X-Proofpoint-GUID: cue_y-qazPCNjCi9FU_TAdMK1cJo0UhR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-25_16,2023-11-22_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sat, 25 Nov 2023 08:36:10 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783554585280788507 X-GMAIL-MSGID: 1783554585280788507 |
Series |
[net] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam
|
|
Commit Message
Subbaraya Sundeep
Nov. 25, 2023, 4:35 p.m. UTC
All the mailbox messages sent to AF needs to be guarded
by mutex lock. Add the missing lock in otx2_get_pauseparam
function.
Fixes: 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
---
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On Sat, Nov 25, 2023 at 10:05:41PM +0530, Subbaraya Sundeep wrote: > All the mailbox messages sent to AF needs to be guarded > by mutex lock. Add the missing lock in otx2_get_pauseparam > function. > > Fixes: 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool") > Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com> Hi, I am wondering if the call to otx2_nix_config_bp() in otx2_dcbnl_ieee_setpfc() also needs to be protected by mbox.lock. And although not strictly related to this patch, while looking over this, I noticed that in otx2_init_hw_resources() it appears that &mbox->lock may be unlocked twice in some error paths. e.g. /* Init Auras and pools used by NIX RQ, for free buffer ptrs */ err = otx2_rq_aura_pool_init(pf); if (err) { mutex_unlock(&mbox->lock); goto err_free_nix_lf; } ... err_free_nix_lf: mutex_lock(&mbox->lock); ... ...
Hi Simon, >-----Original Message----- >From: Simon Horman <horms@kernel.org> >Sent: Tuesday, November 28, 2023 10:51 PM >To: Subbaraya Sundeep Bhatta <sbhatta@marvell.com> >Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; kuba@kernel.org; >davem@davemloft.net; pabeni@redhat.com; edumazet@google.com; Sunil >Kovvuri Goutham <sgoutham@marvell.com>; Geethasowjanya Akula ><gakula@marvell.com>; Hariprasad Kelam <hkelam@marvell.com> >Subject: [EXT] Re: [PATCH net] octeontx2-pf: Add missing mutex lock in >otx2_get_pauseparam > >---------------------------------------------------------------------- >On Sat, Nov 25, 2023 at 10:05:41PM +0530, Subbaraya Sundeep wrote: >> All the mailbox messages sent to AF needs to be guarded by mutex lock. >> Add the missing lock in otx2_get_pauseparam function. >> >> Fixes: 75f36270990c ("octeontx2-pf: Support to enable/disable pause >> frames via ethtool") >> Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com> > >Hi, > >I am wondering if the call to otx2_nix_config_bp() in otx2_dcbnl_ieee_setpfc() >also needs to be protected by mbox.lock. > Correct. I will add lock around it and send v2 of this patch. >And although not strictly related to this patch, while looking over this, I >noticed that in otx2_init_hw_resources() it appears that &mbox->lock may be >unlocked twice in some error paths. > >e.g. > /* Init Auras and pools used by NIX RQ, for free buffer ptrs */ > err = otx2_rq_aura_pool_init(pf); > if (err) { > mutex_unlock(&mbox->lock); > goto err_free_nix_lf; > } > ... >err_free_nix_lf: > mutex_lock(&mbox->lock); > ... > >... Will fix it and send it as another patch. Thanks, Sundeep
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c index 9efcec5..53f6258 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c @@ -334,9 +334,12 @@ static void otx2_get_pauseparam(struct net_device *netdev, if (is_otx2_lbkvf(pfvf->pdev)) return; + mutex_lock(&pfvf->mbox.lock); req = otx2_mbox_alloc_msg_cgx_cfg_pause_frm(&pfvf->mbox); - if (!req) + if (!req) { + mutex_unlock(&pfvf->mbox.lock); return; + } if (!otx2_sync_mbox_msg(&pfvf->mbox)) { rsp = (struct cgx_pause_frm_cfg *) @@ -344,6 +347,7 @@ static void otx2_get_pauseparam(struct net_device *netdev, pause->rx_pause = rsp->rx_pause; pause->tx_pause = rsp->tx_pause; } + mutex_unlock(&pfvf->mbox.lock); } static int otx2_set_pauseparam(struct net_device *netdev,