Unverified Commit 1f027a60 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11985 Fix CVE-2024-46845

Merge Pull Request from: @ci-robot 
 
PR sync from: Zheng Yejian <zhengyejian1@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/LC5URNZF3NTVPPW6MVIWSQUPIW2RVAUY/ 
Steven Rostedt (2):
  tracing/timerlat: Only clear timer if a kthread exists
  tracing/osnoise: Fix build when timerlat is not enabled


-- 
2.25.1
 
https://gitee.com/src-openeuler/kernel/issues/IAU9OQ 
 
Link:https://gitee.com/openeuler/kernel/pulls/11985

 

Reviewed-by: default avatarZhang Peng <zhangpeng362@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents c594039d 0faf0257
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -228,6 +228,11 @@ static inline struct osnoise_variables *this_cpu_osn_var(void)
	return this_cpu_ptr(&per_cpu_osnoise_var);
}

/*
 * Protect the interface.
 */
static struct mutex interface_lock;

#ifdef CONFIG_TIMERLAT_TRACER
/*
 * Runtime information for the timer mode.
@@ -259,14 +264,20 @@ static inline void tlat_var_reset(void)
{
	struct timerlat_variables *tlat_var;
	int cpu;

	/* Synchronize with the timerlat interfaces */
	mutex_lock(&interface_lock);
	/*
	 * So far, all the values are initialized as 0, so
	 * zeroing the structure is perfect.
	 */
	for_each_cpu(cpu, cpu_online_mask) {
		tlat_var = per_cpu_ptr(&per_cpu_timerlat_var, cpu);
		if (tlat_var->kthread)
			hrtimer_cancel(&tlat_var->timer);
		memset(tlat_var, 0, sizeof(*tlat_var));
	}
	mutex_unlock(&interface_lock);
}
#else /* CONFIG_TIMERLAT_TRACER */
#define tlat_var_reset()	do {} while (0)
@@ -331,11 +342,6 @@ struct timerlat_sample {
};
#endif

/*
 * Protect the interface.
 */
static struct mutex interface_lock;

/*
 * Tracer data.
 */
@@ -2591,6 +2597,7 @@ static int timerlat_fd_release(struct inode *inode, struct file *file)
	osn_var = per_cpu_ptr(&per_cpu_osnoise_var, cpu);
	tlat_var = per_cpu_ptr(&per_cpu_timerlat_var, cpu);

	if (tlat_var->kthread)
		hrtimer_cancel(&tlat_var->timer);
	memset(tlat_var, 0, sizeof(*tlat_var));