lkml.org 
[lkml]   [2015]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched/core: Clear the root_domain cpumasks in init_rootdomain()

* Xunlei Pang <xlpang@redhat.com> wrote:

> > Hm, is the alloc_cpumask_var() done in alloc_sched_domains() safe?
>
> Until now, I haven't found any other similar issues, but I will check further.
>
> >
> > At least the usage pattern in init_sched_domains() looks unsafe:
> >
> > doms_cur = alloc_sched_domains(ndoms_cur);
> > if (!doms_cur)
> > doms_cur = &fallback_doms;
> > cpumask_andnot(doms_cur[0], cpu_map, cpu_isolated_map);

So is this pattern in init_sched_domains() correct, for OFFSTACK=y?

It looks wrong to me, as alloc_sched_domains() allocates an uninitialized cpumask
via alloc_cpumask_var() and returns it:

cpumask_var_t *alloc_sched_domains(unsigned int ndoms)
{
int i;
cpumask_var_t *doms;

doms = kmalloc(sizeof(*doms) * ndoms, GFP_KERNEL);
if (!doms)
return NULL;
for (i = 0; i < ndoms; i++) {
if (!alloc_cpumask_var(&doms[i], GFP_KERNEL)) {
free_sched_domains(doms, i);
return NULL;
}
}
return doms;
}

and then this code:

> > cpumask_andnot(doms_cur[0], cpu_map, cpu_isolated_map);

uses it without first clearing it.

So is this another such bug, or am I missing something?

Thanks,

Ingo


\
 
 \ /
  Last update: 2015-12-04 10:01    [W:0.098 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site