diff options
Diffstat (limited to 'fs/proc/proc_misc.c')
-rw-r--r-- | fs/proc/proc_misc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index b14f43d25e9e..ded969862960 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -464,14 +464,25 @@ static const struct file_operations proc_slabstats_operations = { | |||
464 | #ifdef CONFIG_MMU | 464 | #ifdef CONFIG_MMU |
465 | static int vmalloc_open(struct inode *inode, struct file *file) | 465 | static int vmalloc_open(struct inode *inode, struct file *file) |
466 | { | 466 | { |
467 | return seq_open(file, &vmalloc_op); | 467 | unsigned int *ptr = NULL; |
468 | int ret; | ||
469 | |||
470 | if (NUMA_BUILD) | ||
471 | ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL); | ||
472 | ret = seq_open(file, &vmalloc_op); | ||
473 | if (!ret) { | ||
474 | struct seq_file *m = file->private_data; | ||
475 | m->private = ptr; | ||
476 | } else | ||
477 | kfree(ptr); | ||
478 | return ret; | ||
468 | } | 479 | } |
469 | 480 | ||
470 | static const struct file_operations proc_vmalloc_operations = { | 481 | static const struct file_operations proc_vmalloc_operations = { |
471 | .open = vmalloc_open, | 482 | .open = vmalloc_open, |
472 | .read = seq_read, | 483 | .read = seq_read, |
473 | .llseek = seq_lseek, | 484 | .llseek = seq_lseek, |
474 | .release = seq_release, | 485 | .release = seq_release_private, |
475 | }; | 486 | }; |
476 | #endif | 487 | #endif |
477 | 488 | ||