From patchwork Wed Nov 29 05:23:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Subbaraya Sundeep X-Patchwork-Id: 13472206 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="dRoTA+/q" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE5881BE; Tue, 28 Nov 2023 21:23:57 -0800 (PST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ASIdt2Q021069; Tue, 28 Nov 2023 21:23:51 -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=RyQNu/4f6bw63umQMN6av9DZSEVhbf5Xz7SFVkrjG6c=; b=dRoTA+/qReOFVuar7zJPScRoUn4NKrjiON1fHQR0sZs/yo1wkjJiGlPBgBUyXaYHuavV VDjRNhw1cnuMqC+aXzD6LVgmVC/i39LSfvcoSlsFYXgkva+RBc3AWDxHCrF2Vv2ctBNC 1Zr+fONsyhUy5eeU36ota54GRz2GcHZQt2Ffxj7hN2ISyhJWfxbe78NQ2MLrfQ/4X830 hKCLuJJBiCZW7yK+Vtxl67aOBwysT/Y28KlTd9NyVEGaXvlKAaxRMXHSCYoSEg90EA3Y PfDNI6ID8F4k4waLxj7YzhPqOXqzv6ttJEm27MCj0dJnq9RjoKKHlDCWNfIAcqYyINPW pg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3unn86a18w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 21:23:51 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 28 Nov 2023 21:23:49 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 28 Nov 2023 21:23:49 -0800 Received: from hyd1358.marvell.com (unknown [10.29.37.11]) by maili.marvell.com (Postfix) with ESMTP id ADB743F7048; Tue, 28 Nov 2023 21:23:45 -0800 (PST) From: Subbaraya Sundeep To: , CC: , , , , , , , , , "Subbaraya Sundeep" Subject: [PATCH v2 net] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam Date: Wed, 29 Nov 2023 10:53:42 +0530 Message-ID: <1701235422-22488-1-git-send-email-sbhatta@marvell.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: GzgL5lzcAPokTodDWzZsP1yHw-0rQYGU X-Proofpoint-GUID: GzgL5lzcAPokTodDWzZsP1yHw-0rQYGU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-29_02,2023-11-27_01,2023-05-22_02 X-Patchwork-Delegate: kuba@kernel.org 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 Reviewed-by: Simon Horman --- v2 changes: Added maintainers of AF driver too drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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,