Merge "audio_ssr: Mutex dead lock"

Esse commit está contido em:
qctecmdr
2024-02-02 23:49:11 -08:00
commit de Gerrit - the friendly Code Review server

Ver arquivo

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (c) 2016-2017, 2020-2021 The Linux Foundation. All rights reserved. * Copyright (c) 2016-2017, 2020-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/ */
#include <linux/init.h> #include <linux/init.h>
@@ -246,8 +246,10 @@ static int audio_notifier_dereg_service(int service, int domain)
__func__, service_data[service][domain].name, __func__, service_data[service][domain].name,
service_data[service][domain].handle); service_data[service][domain].handle);
mutex_lock(&notifier_mutex);
service_data[service][domain].state = AUDIO_NOTIFIER_SERVICE_DOWN; service_data[service][domain].state = AUDIO_NOTIFIER_SERVICE_DOWN;
service_data[service][domain].handle = NULL; service_data[service][domain].handle = NULL;
mutex_unlock(&notifier_mutex);
done: done:
return ret; return ret;
} }
@@ -459,16 +461,16 @@ static int audio_notifier_service_cb(unsigned long opcode,
__func__, service_data[service][domain].name, notifier_opcode); __func__, service_data[service][domain].name, notifier_opcode);
mutex_lock(&notifier_mutex); mutex_lock(&notifier_mutex);
service_data[service][domain].state = notifier_opcode; service_data[service][domain].state = notifier_opcode;
ret = srcu_notifier_call_chain(&service_data[service][domain]. ret = srcu_notifier_call_chain(&service_data[service][domain].
client_nb_list, notifier_opcode, &data); client_nb_list, notifier_opcode, &data);
mutex_unlock(&notifier_mutex);
if (ret < 0) if (ret < 0)
pr_err_ratelimited("%s: srcu_notifier_call_chain returned %d, service %s, \ pr_err_ratelimited("%s: srcu_notifier_call_chain returned %d, service %s, \
opcode 0x%lx\n", __func__, ret, service_data[service][domain].name, opcode 0x%lx\n", __func__, ret, service_data[service][domain].name,
notifier_opcode); notifier_opcode);
mutex_unlock(&notifier_mutex);
return NOTIFY_OK; return NOTIFY_OK;
} }
@@ -506,7 +508,6 @@ int audio_notifier_deregister(char *client_name)
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
} }
mutex_lock(&notifier_mutex);
list_for_each_safe(ptr, next, &client_list) { list_for_each_safe(ptr, next, &client_list) {
client_data = list_entry(ptr, struct client_data, list); client_data = list_entry(ptr, struct client_data, list);
if (!strcmp(client_name, client_data->client_name)) { if (!strcmp(client_name, client_data->client_name)) {
@@ -523,7 +524,6 @@ int audio_notifier_deregister(char *client_name)
kfree(client_data); kfree(client_data);
} }
} }
mutex_unlock(&notifier_mutex);
done: done:
return ret; return ret;
} }