From: Qiu-ji Chen <chenqiuji666(a)gmail.com>
stable inclusion
from stable-v4.19.325
commit d16109c9fdc1b8cea4fe63b42e06e926c3f68990
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBEDOW
CVE: CVE-2024-56700
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id…
--------------------------------
commit ca59f9956d4519ab18ab2270be47c6b8c6ced091 upstream.
Atomicity violation occurs when the fmc_send_cmd() function is executed
simultaneously with the modification of the fmdev->resp_skb value.
Consider a scenario where, after passing the validity check within the
function, a non-null fmdev->resp_skb variable is assigned a null value.
This results in an invalid fmdev->resp_skb variable passing the validity
check. As seen in the later part of the function, skb = fmdev->resp_skb;
when the invalid fmdev->resp_skb passes the check, a null pointer
dereference error may occur at line 478, evt_hdr = (void *)skb->data;
To address this issue, it is recommended to include the validity check of
fmdev->resp_skb within the locked section of the function. This
modification ensures that the value of fmdev->resp_skb does not change
during the validation process, thereby maintaining its validity.
This possible bug is found by an experimental static analysis tool
developed by our team. This tool analyzes the locking APIs
to extract function pairs that can be concurrently executed, and then
analyzes the instructions in the paired functions to identify possible
concurrency bugs including data races and atomicity violations.
Fixes: e8454ff7b9a4 ("[media] drivers:media:radio: wl128x: FM Driver Common sources")
Cc: stable(a)vger.kernel.org
Signed-off-by: Qiu-ji Chen <chenqiuji666(a)gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco(a)xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Signed-off-by: dinglongwei <dinglongwei1(a)huawei.com>
---
drivers/media/radio/wl128x/fmdrv_common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c
index 1cf4019689a5..8b8453dab660 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -472,11 +472,12 @@ int fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload,
jiffies_to_msecs(FM_DRV_TX_TIMEOUT) / 1000);
return -ETIMEDOUT;
}
+ spin_lock_irqsave(&fmdev->resp_skb_lock, flags);
if (!fmdev->resp_skb) {
+ spin_unlock_irqrestore(&fmdev->resp_skb_lock, flags);
fmerr("Response SKB is missing\n");
return -EFAULT;
}
- spin_lock_irqsave(&fmdev->resp_skb_lock, flags);
skb = fmdev->resp_skb;
fmdev->resp_skb = NULL;
spin_unlock_irqrestore(&fmdev->resp_skb_lock, flags);
--
2.22.0
tree: https://gitee.com/openeuler/kernel.git OLK-5.10
head: 2a9b96eb97cfd6f68e431cb614cb0b75b127d783
commit: abfd8691d951fb037506e1ee52ed39abee8430fa [2610/2610] etmem: add swapcache reclaim to etmem
config: x86_64-randconfig-161-20241231 (https://download.01.org/0day-ci/archive/20241231/202412311538.MIuGFM8n-lkp@…)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412311538.MIuGFM8n-lkp@intel.com/
smatch warnings:
mm/vmscan.c:4737 get_swapcache_reclaim_num() warn: unsigned 'swapcache_watermark[0]' is never less than zero.
vim +4737 mm/vmscan.c
4733
4734 static unsigned long get_swapcache_reclaim_num(unsigned long *swapcache_watermark)
4735 {
4736 return total_swapcache_pages() >
> 4737 swapcache_watermark[ETMEM_SWAPCACHE_WMARK_LOW] ?
4738 (total_swapcache_pages() - swapcache_watermark[ETMEM_SWAPCACHE_WMARK_LOW]) : 0;
4739 }
4740
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
hulk inclusion
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBEBAG
--------------------------------
The task_rq selection of dynamic affinity use cpu capacity to determine
select_cpus range. When realtime tasks are running on the cpu all the time,
cfs tasks and the thread of softirq is suppressed, and the cpu capacity is
not updated in time. As a result, the select_cpus range is always selected
for preferred_cpus. then cfs task will never be able to run because
realtime tasks has been running.
Therefore, if realtime tasks is running during the task_rq selection of
dynamic affinity, the cpu capacity should be calculated to solve such
a problem.
Fixes: 70a232a564cf ("sched: Adjust wakeup cpu range according CPU util dynamicly")
Signed-off-by: He Yujie <coka.heyujie(a)huawei.com>
---
kernel/sched/fair.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 63f4344ac344..4a357dce540c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7226,6 +7226,19 @@ static inline bool prefer_cpus_valid(struct task_struct *p)
cpumask_subset(prefer_cpus, &p->cpus_allowed);
}
+static unsigned long scale_rt_capacity(struct sched_domain *sd, int cpu);
+
+static inline unsigned long calc_cpu_capacity(int cpu)
+{
+ unsigned long capacity;
+
+ capacity = scale_rt_capacity(NULL, cpu);
+ if (!capacity)
+ capacity = 1;
+
+ return capacity;
+}
+
/*
* set_task_select_cpus: select the cpu range for task
* @p: the task whose available cpu range will to set
@@ -7288,7 +7301,11 @@ static void set_task_select_cpus(struct task_struct *p, int *idlest_cpu,
}
util_avg_sum += tg->se[cpu]->avg.util_avg;
- tg_capacity += capacity_of(cpu);
+
+ if (cpu_rq(cpu)->rt.rt_nr_running)
+ tg_capacity += calc_cpu_capacity(cpu);
+ else
+ tg_capacity += capacity_of(cpu);
}
rcu_read_unlock();
--
2.34.1