From: Dan Carpenter <dan.carpenter(a)linaro.org>
stable inclusion
from stable-v4.19.325
commit 3c7c806b3eafd94ae0f77305a174d63b69ec187c
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBEAEH
CVE: CVE-2024-53165
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id…
--------------------------------
[ Upstream commit 63e72e551942642c48456a4134975136cdcb9b3c ]
In the error handling for this function, d is freed without ever
removing it from intc_list which would lead to a use after free.
To fix this, let's only add it to the list after everything has
succeeded.
Fixes: 2dcec7a988a1 ("sh: intc: set_irq_wake() support")
Signed-off-by: Dan Carpenter <dan.carpenter(a)linaro.org>
Reviewed-by: John Paul Adrian Glaubitz <glaubitz(a)physik.fu-berlin.de>
Signed-off-by: John Paul Adrian Glaubitz <glaubitz(a)physik.fu-berlin.de>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
Signed-off-by: Zhang Kunbo <zhangkunbo(a)huawei.com>
---
drivers/sh/intc/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 46f0f322d4d8..48fe5fab5693 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -194,7 +194,6 @@ int __init register_intc_controller(struct intc_desc *desc)
goto err0;
INIT_LIST_HEAD(&d->list);
- list_add_tail(&d->list, &intc_list);
raw_spin_lock_init(&d->lock);
INIT_RADIX_TREE(&d->tree, GFP_ATOMIC);
@@ -380,6 +379,7 @@ int __init register_intc_controller(struct intc_desc *desc)
d->skip_suspend = desc->skip_syscore_suspend;
+ list_add_tail(&d->list, &intc_list);
nr_intc_controllers++;
return 0;
--
2.34.1
tree: https://gitee.com/openeuler/kernel.git OLK-5.10
head: 55bf638d3d29c53ddd64ed89efda8b70b47ccbbc
commit: 5361bef36768820fb029e081a669749b8001769e [2616/2616] memcg: add restrict to swap to cgroup1
config: arm64-randconfig-r052-20250101 (https://download.01.org/0day-ci/archive/20250101/202501011625.6qilIzlu-lkp@…)
compiler: aarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250101/202501011625.6qilIzlu-lkp@…)
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/202501011625.6qilIzlu-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> mm/memcontrol.c:4167:5: warning: no previous prototype for 'memcg_swapmax_read' [-Wmissing-prototypes]
4167 | u64 memcg_swapmax_read(struct cgroup_subsys_state *css, struct cftype *cft)
| ^~~~~~~~~~~~~~~~~~
vim +/memcg_swapmax_read +4167 mm/memcontrol.c
4166
> 4167 u64 memcg_swapmax_read(struct cgroup_subsys_state *css, struct cftype *cft)
4168 {
4169 struct mem_cgroup *memcg = mem_cgroup_from_css(css);
4170
4171 if (!static_branch_likely(&memcg_swap_qos_key))
4172 return PAGE_COUNTER_MAX * PAGE_SIZE;
4173
4174 return READ_ONCE(memcg->swap_dev->max) * PAGE_SIZE;
4175 }
4176
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
tree: https://gitee.com/openeuler/kernel.git OLK-6.6
head: 1e531b8351b843cd4a160764c0f67e4c9805234d
commit: cf98ffbc116bc49dc4506c68e20b02e26519ad35 [1682/1682] mm/dynamic_pool: fill dpool with pagelist
config: x86_64-randconfig-121-20250101 (https://download.01.org/0day-ci/archive/20250101/202501011500.zzJzjVne-lkp@…)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250101/202501011500.zzJzjVne-lkp@…)
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/202501011500.zzJzjVne-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
mm/dynamic_pool.c:999:55: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct cgroup_subsys_state *css @@ got struct cgroup_subsys_state [noderef] __rcu * @@
mm/dynamic_pool.c:999:55: sparse: expected struct cgroup_subsys_state *css
mm/dynamic_pool.c:999:55: sparse: got struct cgroup_subsys_state [noderef] __rcu *
>> mm/dynamic_pool.c:1577:25: sparse: sparse: symbol 'pagelist_dpool_ops' was not declared. Should it be static?
vim +/pagelist_dpool_ops +1577 mm/dynamic_pool.c
1576
> 1577 struct dynamic_pool_ops pagelist_dpool_ops = {
1578 .fill_pool = dpool_fill_from_pagelist,
1579 .drain_pool = dpool_drain_to_pagelist,
1580 .restore_pool = dpool_migrate_used_pages,
1581 };
1582
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Zhang,
FYI, the error/warning still remains.
tree: https://gitee.com/openeuler/kernel.git OLK-6.6
head: 1e531b8351b843cd4a160764c0f67e4c9805234d
commit: 926b9b0cd97e640ee680347cf449c3dc152dddd2 [1682/1682] sched: Throttle qos cfs_rq when current cpu is running online task
config: x86_64-randconfig-121-20250101 (https://download.01.org/0day-ci/archive/20250101/202501010909.j7gDYmAD-lkp@…)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250101/202501010909.j7gDYmAD-lkp@…)
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/202501010909.j7gDYmAD-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/export.h:5,
from include/linux/linkage.h:7,
from include/linux/kernel.h:17,
from include/linux/cpumask.h:10,
from include/linux/energy_model.h:4,
from kernel/sched/fair.c:23:
kernel/sched/fair.c: In function 'check_qos_cfs_rq':
>> kernel/sched/fair.c:8325:23: error: implicit declaration of function 'sched_idle_cpu'; did you mean 'sched_idle_rq'? [-Werror=implicit-function-declaration]
8325 | !sched_idle_cpu(smp_processor_id()) &&
| ^~~~~~~~~~~~~~
include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
>> kernel/sched/fair.c:8328:35: error: 'struct rq' has no member named 'online'
8328 | if (!rq_of(cfs_rq)->online)
| ^~
kernel/sched/fair.c: In function 'pick_next_task_fair':
>> kernel/sched/fair.c:8531:19: error: 'struct rq' has no member named 'idle_stamp'
8531 | rq->idle_stamp = 0;
| ^~
kernel/sched/fair.c: At top level:
kernel/sched/fair.c:8166:13: warning: 'start_qos_hrtimer' used but never defined
8166 | static void start_qos_hrtimer(int cpu);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +8325 kernel/sched/fair.c
8321
8322 static bool check_qos_cfs_rq(struct cfs_rq *cfs_rq)
8323 {
8324 if (unlikely(cfs_rq && cfs_rq->tg->qos_level < 0 &&
> 8325 !sched_idle_cpu(smp_processor_id()) &&
8326 cfs_rq->h_nr_running == cfs_rq->idle_h_nr_running)) {
8327
> 8328 if (!rq_of(cfs_rq)->online)
8329 return false;
8330
8331 throttle_qos_cfs_rq(cfs_rq);
8332 return true;
8333 }
8334
8335 return false;
8336 }
8337
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki