Skip to content

Commit a3c0399

Browse files
Chen Gangtorvalds
authored andcommitted
fs/proc/task_mmu.c: check the return value of mpol_to_str()
mpol_to_str() may fail, and not fill the buffer (e.g. -EINVAL), so need check about it, or buffer may not be zero based, and next seq_printf() will cause issue. The failure return need after mpol_cond_put() to match get_vma_policy(). Signed-off-by: Chen Gang <gang.chen@asianux.com> Cc: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Andi Kleen <andi@firstfloor.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4649602 commit a3c0399

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎fs/proc/task_mmu.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,8 +1402,10 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
14021402
walk.mm = mm;
14031403

14041404
pol = get_vma_policy(task, vma, vma->vm_start);
1405-
mpol_to_str(buffer, sizeof(buffer), pol);
1405+
n = mpol_to_str(buffer, sizeof(buffer), pol);
14061406
mpol_cond_put(pol);
1407+
if (n < 0)
1408+
return n;
14071409

14081410
seq_printf(m, "%08lx %s", vma->vm_start, buffer);
14091411

0 commit comments

Comments
 (0)