diff options
author | Amanpreet Kaur <quic_amankaur@quicinc.com> | 2023-02-20 02:36:51 -0800 |
---|---|---|
committer | Amanpreet Kaur <quic_amankaur@quicinc.com> | 2023-02-28 23:59:02 -0800 |
commit | 1a15b371a7fc2e304838f404820a6cd583a217be (patch) | |
tree | 15b036dcd317f91a13c64862a81f9a7661cf9b8f | |
parent | a9c067648543f5671413ebf47756af4152b1be0f (diff) | |
download | securemsm-1a15b371a7fc2e304838f404820a6cd583a217be.tar.gz |
tz_log: Make creation of directories dependent on whether hypervisor is enabled.
Disable creation of hyp_general, hyp_log and rm_log directories if hypervisor is disabled.
Change-Id: I5a7b73dd9dbda9c438d99b1e644a201367eb124f
-rw-r--r-- | tz_log/tz_log.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tz_log/tz_log.c b/tz_log/tz_log.c index 411104d..ef87a32 100644 --- a/tz_log/tz_log.c +++ b/tz_log/tz_log.c @@ -1460,6 +1460,20 @@ static void tzdbg_free_encrypted_log_buf(struct platform_device *pdev) enc_qseelog_info.vaddr, enc_qseelog_info.paddr); } +static bool is_hyp_dir(int tzdbg_stat_type) +{ + switch(tzdbg_stat_type) + { + case TZDBG_HYP_GENERAL: + case TZDBG_HYP_LOG: + case TZDBG_RM_LOG: + return true; + default: + return false; + } + return false; +} + static int tzdbg_fs_init(struct platform_device *pdev) { int rc = 0; @@ -1475,6 +1489,14 @@ static int tzdbg_fs_init(struct platform_device *pdev) for (i = 0; i < TZDBG_STATS_MAX; i++) { tzdbg.debug_tz[i] = i; + /* + * If hypervisor is disabled, do not create + * hyp_general, hyp_log and rm_log directories, + * as accessing them would give segmentation fault + */ + if ((!tzdbg.is_hyplog_enabled) && (is_hyp_dir(i))) { + continue; + } dent = proc_create_data(tzdbg.stat[i].name, 0444, dent_dir, &tzdbg_fops, &tzdbg.debug_tz[i]); |