diff mbox series

[SRU,F:linux-bluefield,v5,1/4] UBUNTU: SAUCE: mlx-bootctl: Fix exclusion issues around arm_smccc_smc

Message ID 20210707081625.5066-2-shravankr@nvidia.com
State New
Headers show
Series Updates to mlx-bootctl | expand

Commit Message

Shravan Kumar Ramani July 7, 2021, 8:16 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1931843

Exclusion is being handled around arm_smccc_smc() only in the store
function. Add similar mutex_lock/unlock in the show function as well.

Signed-off-by: Shravan Kumar Ramani <shravankr@nvidia.com>
---
 drivers/platform/mellanox/mlx-bootctl.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/platform/mellanox/mlx-bootctl.c b/drivers/platform/mellanox/mlx-bootctl.c
index 6eff360551d9..67de265af5bb 100644
--- a/drivers/platform/mellanox/mlx-bootctl.c
+++ b/drivers/platform/mellanox/mlx-bootctl.c
@@ -298,8 +298,10 @@  static ssize_t oob_mac_show(struct device_driver *drv, char *buf)
 	struct arm_smccc_res res;
 	u8 *mac_byte_ptr;
 
+	mutex_lock(&mfg_ops_lock);
 	arm_smccc_smc(MLNX_HANDLE_GET_MFG_INFO, MLNX_MFG_TYPE_OOB_MAC, 0, 0, 0,
 		      0, 0, 0, &res);
+	mutex_unlock(&mfg_ops_lock);
 	if (res.a0)
 		return -EPERM;
 
@@ -364,7 +366,9 @@  static int get_opn_data(u64 *data, u8 word)
 	if (!type || !data)
 		return -EINVAL;
 
+	mutex_lock(&mfg_ops_lock);
 	arm_smccc_smc(MLNX_HANDLE_GET_MFG_INFO, type, 0, 0, 0, 0, 0, 0, &res);
+	mutex_unlock(&mfg_ops_lock);
 	if (res.a0)
 		return -EPERM;
 
@@ -382,8 +386,10 @@  static int set_opn_data(u64 data, u8 word)
 	if (!type)
 		return -EINVAL;
 
+	mutex_lock(&mfg_ops_lock);
 	arm_smccc_smc(MLNX_HANDLE_SET_MFG_INFO, type, sizeof(u64), data, 0, 0,
 		      0, 0, &res);
+	mutex_unlock(&mfg_ops_lock);
 	if (res.a0)
 		return -EPERM;