Browse Source

s390/process: free vx save area when releasing tasks

If a task uses vector registers, a save area is allocated to save/restore
register states.  Free the save area when releasing the task.

Found the Memory leak with kmemleak:

unreferenced object 0x72885e00 (size 512):
  comm "vx-test", pid 26123, jiffies 4294945635 (age 256.810s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 01 db 71 06 41  .............q.A
    00 00 00 00 00 00 00 00 24 f7 a9 a7 51 94 79 bb  ........$...Q.y.
  backtrace:
    [<00000000002d1c8a>] kmem_cache_alloc_trace+0x272/0x3d0
    [<00000000001014ac>] alloc_vector_registers+0x54/0x138
    [<00000000001017c8>] data_exception+0x158/0x1b0
    [<00000000008b551e>] pgm_check_handler+0x13e/0x180
    [<00000000800008b6>] 0x800008b6

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Hendrik Brueckner 10 years ago
parent
commit
6a039eab53
1 changed files with 8 additions and 0 deletions
  1. 8 0
      arch/s390/kernel/process.c

+ 8 - 0
arch/s390/kernel/process.c

@@ -79,6 +79,14 @@ void release_thread(struct task_struct *dead_task)
 {
 }
 
+#ifdef CONFIG_64BIT
+void arch_release_task_struct(struct task_struct *tsk)
+{
+	if (tsk->thread.vxrs)
+		kfree(tsk->thread.vxrs);
+}
+#endif
+
 int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
 		unsigned long arg, struct task_struct *p)
 {