From: Linus Torvalds Date: Mon, 28 Mar 2011 02:09:29 +0000 (-0700) Subject: proc: fix oops on invalid /proc//maps access, CVE-2011-1020 X-Git-Url: http://git.alex.org.uk proc: fix oops on invalid /proc//maps access, CVE-2011-1020 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 ec6fd8a4355c ("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: Anca Emanuel Reported-by: Tony Luck Cc: Al Viro Cc: Américo Wang Cc: Stephen Wilson Signed-off-by: Linus Torvalds (cherry picked from commit 76597cd31470fa130784c78fadb4dab2e624a723) CVE-2011-1020 BugLink: http://bugs.launchpad.net/bugs/813026 Signed-off-by: Tim Gardner --- diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 77e7bb9..7f5e572 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -180,7 +180,8 @@ static void m_stop(struct seq_file *m, void *v) struct proc_maps_private *priv = m->private; struct vm_area_struct *vma = v; - vma_stop(priv, vma); + if (!IS_ERR(vma)) + vma_stop(priv, vma); if (priv->task) put_task_struct(priv->task); }