From f6e78d3ecd50720453233772bf71246ddf247a98 Mon Sep 17 00:00:00 2001 From: Matthew Rosato Date: Wed, 5 Jul 2023 08:54:13 -0400 Subject: [PATCH] ap_tools/ap-check: hold ap config file lock over get attributes Since this callout reads sysfs values for the specified mdev, the ap config file lock should be held to prevent other tools from making changes to the ap configuration at the same time. Reviewed-by: Jason J. Herne Reviewed-by: Tony Krowiak Reviewed-by: Boris Fiuczynski Signed-off-by: Matthew Rosato Signed-off-by: Steffen Eiden --- ap_tools/ap-check.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ap_tools/ap-check.c b/ap_tools/ap-check.c index 621567df..cb44453e 100644 --- a/ap_tools/ap-check.c +++ b/ap_tools/ap-check.c @@ -787,6 +787,14 @@ static int ap_check_handle_get_attributes(struct ap_check_anchor *anc) char buf[80]; char *path; FILE *f; + int rc; + + rc = ap_get_lock_callout(); + if (rc) { + fprintf(stderr, "Failed to acquire configuration lock %d\n", rc); + return -1; + } + anc->cleanup_lock = true; path = path_get_vfio_ap_attr(anc->uuid, "matrix"); f = fopen(path, "r");