Fix: check driver version in MM communicate RPC caller
Check if the arm-ffa-user driver's version is in the required range
before opening the MM communicate RPC client.
Signed-off-by: Imre Kis <imre.kis@arm.com>
Change-Id: Ib2a4e655b285f067795d8d9224e7c2fbc811b8e6
diff --git a/components/service/locator/linux/mm_communicate/mm_communicate_location_strategy.c b/components/service/locator/linux/mm_communicate/mm_communicate_location_strategy.c
index 632c682..b9f6a21 100644
--- a/components/service/locator/linux/mm_communicate/mm_communicate_location_strategy.c
+++ b/components/service/locator/linux/mm_communicate/mm_communicate_location_strategy.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -77,6 +77,9 @@
struct mm_communicate_caller mm_communicate_caller;
+ if (!mm_communicate_caller_check_version())
+ return false;
+
mm_communicate_caller_init(&mm_communicate_caller, dev_path);
uint16_t discovered_partitions[MAX_PARTITION_INSTANCES];
diff --git a/components/service/locator/linux/mm_communicate/mm_communicate_service_context.c b/components/service/locator/linux/mm_communicate/mm_communicate_service_context.c
index 7e6330d..358210f 100644
--- a/components/service/locator/linux/mm_communicate/mm_communicate_service_context.c
+++ b/components/service/locator/linux/mm_communicate/mm_communicate_service_context.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -48,6 +48,9 @@
rpc_session_handle session_handle = NULL;
+ if (!mm_communicate_caller_check_version())
+ return NULL;
+
struct mm_communicate_caller *mm_communicate_caller =
(struct mm_communicate_caller*)malloc(sizeof(struct mm_communicate_caller));