diff options
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index d53246863cfb..eafa39a3a88c 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -388,14 +388,17 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, | |||
388 | unsigned long wchan; | 388 | unsigned long wchan; |
389 | char symname[KSYM_NAME_LEN]; | 389 | char symname[KSYM_NAME_LEN]; |
390 | 390 | ||
391 | wchan = get_wchan(task); | 391 | if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) |
392 | goto print0; | ||
392 | 393 | ||
393 | if (wchan && ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS) | 394 | wchan = get_wchan(task); |
394 | && !lookup_symbol_name(wchan, symname)) | 395 | if (wchan && !lookup_symbol_name(wchan, symname)) { |
395 | seq_printf(m, "%s", symname); | 396 | seq_puts(m, symname); |
396 | else | 397 | return 0; |
397 | seq_putc(m, '0'); | 398 | } |
398 | 399 | ||
400 | print0: | ||
401 | seq_putc(m, '0'); | ||
399 | return 0; | 402 | return 0; |
400 | } | 403 | } |
401 | #endif /* CONFIG_KALLSYMS */ | 404 | #endif /* CONFIG_KALLSYMS */ |
@@ -1910,6 +1913,8 @@ static int dname_to_vma_addr(struct dentry *dentry, | |||
1910 | unsigned long long sval, eval; | 1913 | unsigned long long sval, eval; |
1911 | unsigned int len; | 1914 | unsigned int len; |
1912 | 1915 | ||
1916 | if (str[0] == '0' && str[1] != '-') | ||
1917 | return -EINVAL; | ||
1913 | len = _parse_integer(str, 16, &sval); | 1918 | len = _parse_integer(str, 16, &sval); |
1914 | if (len & KSTRTOX_OVERFLOW) | 1919 | if (len & KSTRTOX_OVERFLOW) |
1915 | return -EINVAL; | 1920 | return -EINVAL; |
@@ -1921,6 +1926,8 @@ static int dname_to_vma_addr(struct dentry *dentry, | |||
1921 | return -EINVAL; | 1926 | return -EINVAL; |
1922 | str++; | 1927 | str++; |
1923 | 1928 | ||
1929 | if (str[0] == '0' && str[1]) | ||
1930 | return -EINVAL; | ||
1924 | len = _parse_integer(str, 16, &eval); | 1931 | len = _parse_integer(str, 16, &eval); |
1925 | if (len & KSTRTOX_OVERFLOW) | 1932 | if (len & KSTRTOX_OVERFLOW) |
1926 | return -EINVAL; | 1933 | return -EINVAL; |
@@ -2204,6 +2211,7 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx) | |||
2204 | } | 2211 | } |
2205 | } | 2212 | } |
2206 | up_read(&mm->mmap_sem); | 2213 | up_read(&mm->mmap_sem); |
2214 | mmput(mm); | ||
2207 | 2215 | ||
2208 | for (i = 0; i < nr_files; i++) { | 2216 | for (i = 0; i < nr_files; i++) { |
2209 | char buf[4 * sizeof(long) + 2]; /* max: %lx-%lx\0 */ | 2217 | char buf[4 * sizeof(long) + 2]; /* max: %lx-%lx\0 */ |
@@ -2221,7 +2229,6 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx) | |||
2221 | } | 2229 | } |
2222 | if (fa) | 2230 | if (fa) |
2223 | flex_array_free(fa); | 2231 | flex_array_free(fa); |
2224 | mmput(mm); | ||
2225 | 2232 | ||
2226 | out_put_task: | 2233 | out_put_task: |
2227 | put_task_struct(task); | 2234 | put_task_struct(task); |