diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-11-26 19:29:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-26 20:41:24 -0500 |
commit | 05f564849d49499ced97913a0914b5950577d07d (patch) | |
tree | eaab16738a3d405084466d5a9aca01db37e41f73 /fs | |
parent | 56c176c9cac9a77249fa1736bfd792f379d61942 (diff) |
proc: check vma->vm_file before dereferencing
Commit 7b540d0646ce ("proc_map_files_readdir(): don't bother with
grabbing files") switched proc_map_files_readdir() to use @f_mode
directly instead of grabbing @file reference, but same time the test for
@vm_file presence was lost leading to nil dereference. The patch brings
the test back.
The all proc_map_files feature is CONFIG_CHECKPOINT_RESTORE wrapped
(which is set to 'n' by default) so the bug doesn't affect regular
kernels.
The regression is 3.7-rc1 only as far as I can tell.
[gorcunov@openvz.org: provided changelog]
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/base.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 3c231adf8450..9e28356a959a 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1877,8 +1877,9 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, | |||
1877 | if (!vma) | 1877 | if (!vma) |
1878 | goto out_no_vma; | 1878 | goto out_no_vma; |
1879 | 1879 | ||
1880 | result = proc_map_files_instantiate(dir, dentry, task, | 1880 | if (vma->vm_file) |
1881 | (void *)(unsigned long)vma->vm_file->f_mode); | 1881 | result = proc_map_files_instantiate(dir, dentry, task, |
1882 | (void *)(unsigned long)vma->vm_file->f_mode); | ||
1882 | 1883 | ||
1883 | out_no_vma: | 1884 | out_no_vma: |
1884 | up_read(&mm->mmap_sem); | 1885 | up_read(&mm->mmap_sem); |