Re: [PATCH v2 2/3] mm/sparse: fix possible memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 28 Jun 2012, Gavin Shan wrote:

> >> +{
> >> +	unsigned long size = SECTIONS_PER_ROOT *
> >> +			     sizeof(struct mem_section);
> >> +
> >> +	if (!section)
> >> +		return;
> >> +
> >> +	if (slab_is_available())
> >> +		kfree(section);
> >> +	else
> >> +		free_bootmem_node(NODE_DATA(nid),
> >> +			virt_to_phys(section), size);
> >
> >Did you check what happens here if !node_state(nid, N_HIGH_MEMORY)?
> >
> 
> I'm sorry that I'm not catching your point. Please explain for more
> if necessary.
> 

I'm asking specifically about the free_bootmem_node(NODE_DATA(nid), ...).

If this section was allocated in sparse_index_alloc() before 
slab_is_available() with alloc_bootmem_node() and nid is not in 
N_HIGH_MEMORY, will alloc_bootmem_node() fallback to any node or return 
NULL?

If it falls back to any node, is it safe to try to free that section by 
passing NODE_DATA(nid) here when it wasn't allocated on that nid?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]