Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3af866a0 authored by Nishant Pandey's avatar Nishant Pandey
Browse files

securemsm-kernel: Decrement the server object ref count


in mutex context

Decrement the smcinvoke server object refcount in mutex context
so that we never get an object which is being freed.

Change-Id: I524a58d68c51ef0bec39039915d3d7f88b0c60b2
Signed-off-by: default avatarNishant Pandey <quic_nishpand@quicinc.com>
parent d8204f4d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-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.
 */

#define pr_fmt(fmt) "smcinvoke: %s: " fmt, __func__
@@ -1672,8 +1672,11 @@ static long process_accept_req(struct file *filp, unsigned int cmd,
		}
	} while (!cb_txn);
out:
	if (server_info)
	if (server_info) {
		mutex_lock(&g_smcinvoke_lock);
		kref_put(&server_info->ref_cnt, destroy_cb_server);
		mutex_unlock(&g_smcinvoke_lock);
	}

	if (ret && ret != -ERESTARTSYS)
		pr_err("accept thread returning with ret: %d\n", ret);