Commit 76597cd3 authored by Linus Torvalds's avatar Linus Torvalds

proc: fix oops on invalid /proc/<pid>/maps access

When m_start returns an error, the seq_file logic will still call m_stop
with that error entry, so we'd better make sure that we check it before
using it as a vma.

Introduced by commit ec6fd8a4 ("report errors in /proc/*/*map*
sanely"), which replaced NULL with various ERR_PTR() cases.

(On ia64, you happen to get a unaligned fault instead of a page fault,
since the address used is generally some random error code like -EPERM)
Reported-by: default avatarAnca Emanuel <anca.emanuel@gmail.com>
Reported-by: default avatarTony Luck <tony.luck@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Américo Wang <xiyou.wangcong@gmail.com>
Cc: Stephen Wilson <wilsons@start.ca>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 16c29daf
...@@ -182,7 +182,8 @@ static void m_stop(struct seq_file *m, void *v) ...@@ -182,7 +182,8 @@ static void m_stop(struct seq_file *m, void *v)
struct proc_maps_private *priv = m->private; struct proc_maps_private *priv = m->private;
struct vm_area_struct *vma = v; struct vm_area_struct *vma = v;
vma_stop(priv, vma); if (!IS_ERR(vma))
vma_stop(priv, vma);
if (priv->task) if (priv->task)
put_task_struct(priv->task); put_task_struct(priv->task);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment