proc/slab.c: Initialize struct slab_info in get_slabnode().
Especially its "next" member: this is what caused the crash in "slabtop: Reset slab_list if get_slabinfo() fails." (if parse_slabinfo*() fails in sscanf(), for example, then curr is set to NULL but it is already linked into the "list" and its "next" member was never initialized).
This commit is contained in:
parent
a33be33885
commit
7382ac88d5
@ -48,6 +48,7 @@ static struct slab_info *free_index;
|
|||||||
*/
|
*/
|
||||||
static struct slab_info *get_slabnode(void)
|
static struct slab_info *get_slabnode(void)
|
||||||
{
|
{
|
||||||
|
static const struct slab_info initializer;
|
||||||
struct slab_info *node;
|
struct slab_info *node;
|
||||||
|
|
||||||
if (free_index) {
|
if (free_index) {
|
||||||
@ -56,7 +57,7 @@ static struct slab_info *get_slabnode(void)
|
|||||||
} else {
|
} else {
|
||||||
node = xmalloc(sizeof(struct slab_info));
|
node = xmalloc(sizeof(struct slab_info));
|
||||||
}
|
}
|
||||||
|
*node = initializer;
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user