Skip to content

Commit 75a638b

Browse files
committed
Merge: net/iucv: Avoid explicit cpumask var allocation on stack
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5177 JIRA: https://issues.redhat.com/browse/RHEL-56533 CVE: CVE-2024-42094 Upstream status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Tested: by IBM Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=64160214 Conflicts: None Commits: be4e130 Signed-off-by: Mete Durlu <[email protected]> Approved-by: Steve Best <[email protected]> Approved-by: Tony Camuso <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Rado Vrbovsky <[email protected]>
2 parents 01c9749 + c3578eb commit 75a638b

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

net/iucv/iucv.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ static void iucv_setmask_mp(void)
519519
*/
520520
static void iucv_setmask_up(void)
521521
{
522-
cpumask_t cpumask;
522+
static cpumask_t cpumask;
523523
int cpu;
524524

525525
/* Disable all cpu but the first in cpu_irq_cpumask. */
@@ -627,23 +627,33 @@ static int iucv_cpu_online(unsigned int cpu)
627627

628628
static int iucv_cpu_down_prep(unsigned int cpu)
629629
{
630-
cpumask_t cpumask;
630+
cpumask_var_t cpumask;
631+
int ret = 0;
631632

632633
if (!iucv_path_table)
633634
return 0;
634635

635-
cpumask_copy(&cpumask, &iucv_buffer_cpumask);
636-
cpumask_clear_cpu(cpu, &cpumask);
637-
if (cpumask_empty(&cpumask))
636+
if (!alloc_cpumask_var(&cpumask, GFP_KERNEL))
637+
return -ENOMEM;
638+
639+
cpumask_copy(cpumask, &iucv_buffer_cpumask);
640+
cpumask_clear_cpu(cpu, cpumask);
641+
if (cpumask_empty(cpumask)) {
638642
/* Can't offline last IUCV enabled cpu. */
639-
return -EINVAL;
643+
ret = -EINVAL;
644+
goto __free_cpumask;
645+
}
640646

641647
iucv_retrieve_cpu(NULL);
642648
if (!cpumask_empty(&iucv_irq_cpumask))
643-
return 0;
649+
goto __free_cpumask;
650+
644651
smp_call_function_single(cpumask_first(&iucv_buffer_cpumask),
645652
iucv_allow_cpu, NULL, 1);
646-
return 0;
653+
654+
__free_cpumask:
655+
free_cpumask_var(cpumask);
656+
return ret;
647657
}
648658

649659
/**

0 commit comments

Comments
 (0)